It sounds simple right? Well I have tried time over time. I want to click on a screengui and when I click on it the decal changes to a light switch that is on and the light comes on. Than I want to click it again and it change to the off light switch. Anybody mind helping me write the script it should be very simple.
P.S. It is an ImageButton on the Screengui that changes decals.
This is what I have so far:
On=false
function onClicked()
if On then On=false else
On=true
while On do
script.Parent.Image = Image.new("rbxassetid://173364351")
wait(0.1)
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
That above is the enabler but is there a way to make it so for example I can disable it and enable. I guess I am just kind of confused if someone can clear it up for me.

1 comment
Alright thank you very much, that helps a lot. I am starting to lose my thoughts that is why my script sucks. I forgot about the MouseButton1down and actually had it in my original script. I got the beginning part from a friend and never understood it but hoped it worked. The middle part I tried to do myself. I am actually still learning and this has defiantly helped me along.