Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont the button work?

Asked by 10 years ago

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.

1 answer

Log in to vote
-1
Answered by 10 years ago

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)

0
Ehem,WHAT! threatboy101 2 — 10y
0
COLRS ARENT INSTANCES iluvmaths1123 198 — 10y
Ad

Answer this question