Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont the button work?

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

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)

2 comments

0

Ehem,WHAT!

0

COLRS ARENT INSTANCES

This discussion is preserved as it was. New answers, comments, and votes are closed.