Skip to content

how to access the dropdown when there is "multi = true", here's the code I'm wondering about #57

@ghost

Description

getgenv().LocalConfig = {
    ["Settings"] = {
        ["Remove Effect"] = {
            ["Death"] = false;
            ["Level Up"] = false;
            ["Hit"] = false;
            ["Respawn"] = false;
        };
    };
}
local RemoveEffect = Tabs.SettingsScript:AddDropdown("RemoveEffect", {
    Title = "Remove Effect",
    Description = "You can select multiple values.",
    Values = {"Death", "Level Up", "Hit", "Respawn"},
    Multi = true,
    Default = getgenv().LocalConfig.Settings["Remove Effect"] or {}, -- that's code is correct
    Callback = function(RemoveEffectValue)
        getgenv().LocalConfig.Settings["Remove Effect"] = {}
        for _, v in ipairs(RemoveEffectValue) do
            getgenv().LocalConfig.Settings["Remove Effect"][v] = true
        end
        --saveSettings()
    end
})
task.spawn(function()
    if getgenv().LocalConfig.Settings["Remove Effect"]["Hit"] then
        print("hit effect is remove!")
    end
    if getgenv().LocalConfig.Settings["Remove Effect"]["Death"] then
        print("Death effect is remove!")
    end
    if getgenv().LocalConfig.Settings["Remove Effect"]["Respawn"] then
        print("Respawn effect is remove!")
    end
    if getgenv().LocalConfig.Settings["Remove Effect"]["Level Up"] then
        print("LV effect is remove!")
    end
end)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions