My goal: is to make a graphics button, currently, I’m using some demo code, so I’m just trying to get the mouse button to change it to something different like “low” and “high” every click.
my code: GraphicsButton.MouseButton1Click:Connect(function() blueffect.Enabled = false GraphicsButton.Text = "Low" end)
I can only do it once, how do I change it again if a player wants to change it back to high?
I’m going to guess the answer is very simple, but I just don’t know it.
local Toggle = false
GraphicsButton.MouseButton1Click:Connect(function()
if not Toggle then
Toggle = true
blueffect.Enabled = true
GraphicsButton.Text = "high"
end
if Toggle then
Toggle = false
blueffect.Enabled = false
GraphicsButton.Text = "low"
end
end)
Just an FYI, that toggle won’t work. You need to use an else or elseif in that situation. When you run that, it will see that Toggle is false, then it will set Toggle to true, then the next if statement will check and see that Toggle is true, and it will run that part aswell.