Hello I have a lua global variable used as a settings config made of a list of arrays. I have buttons that visually update when clicked, updating a section of an array. There are other ways to change the settings besides clicking however, but I am not sure how to get the visual effects to indicate which settings have been changed when that is done as the function to update the "state" is not called.
ex of global variable
getgenv().config = {
visual = {
1 = false,
2 = false,
},
audio = {
a = false,
b = false,
}
}
ex of physical button
audio:CreateToggle("mute sound", nil, function(State) config.audio.a = State end)
state function
local function SetState(State)
if State then
Toggle.Toggle.BackgroundColor3 = Config.Color
elseif not State then
Toggle.Toggle.BackgroundColor3 = Color3.fromRGB(50,50,50)
end
ToggleState = State
Callback(State)
end
Is there an easy way I can make sure that the the button is in the right state if the array is updated weather it was clicked or not?