I have a script that is supposed to toggle a variable. It doesn't work, likely because the script is cancelling itself out. How do I fix this? There's no errors, just the script doing its job and therefore stopping itself from doing its job.
function onClicked()
if script.Parent.Parent.Steamflow == true then
script.Parent.Parent.Steamflow = false
end
if script.Parent.Parent.Steamflow == false then
script.Parent.Parent.Steamflow = true
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

3 comments
ginger boi
very nice answer, i like it alot
"not" is a thing? nice. Take my approval