I am making a script in a button that button's default color is green but when it is clicked it makes another part disappear and it turns red but for some reason it works in studio but not in play mode it used to work in play mode it just stays green there is no errors in the output and yes the ClickDetector is sharing the same parent as the script.
Debounce=false function onClicked() if not Debounce then Debounce=true script.Parent.BrickColor=BrickColor.new("Really red") Workspace.invisibleD.Transparency=1 Workspace.invisibleD.CanCollide=false wait(3) Workspace.invisibleD.Transparency=0 Workspace.invisibleD.CanCollide=true wait(5) script.Parent.BrickColor=BrickColor.new("Lime green") Debounce=false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I really appreciate any feedback.
Don't write .new u need Instance.new I haven't tried it yet but see if you can get the instance in there. Games use instances while Studio does not.
Debounce=false function onClicked() if not Debounce then Debounce=true
script.Parent.BrickColor=BrickColor. Instance.new("Really red") Workspace.invisibleD.Transparency=1 Workspace.invisibleD.CanCollide=false wait(3) Workspace.invisibleD.Transparency=0 Workspace.invisibleD.CanCollide=true wait(5) script.Parent.BrickColor=BrickColor.new("Lime green") Debounce=false
end end script.Parent.ClickDetector.MouseClick:connect(onClicked)