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

How do I use a ClickDetector properly?

This is what I tried:

function onClicked(player)
	script.Parent.Parent.Parent.Gate.Transparency = 0.9
	script.Parent.Parent.Parent.Gate.CanCollide = false
end
 
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Thanks in advance for your help!

1 comment

0

What seems to be the problem?

1 answer

There's nothing wrong with your script in it's current state. Either you're not indexing the 'Gate' properly or you're using a localscript.

Make this a Script if it's a LocalScript

Check your parenting.

2 comments

0

I switched it over to a normal script and it still doesn't work.

0

Okay then where is the script's parent?

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