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

Can anyone help me use clickdetectors to perform events when clicked?

Asked by 6 years ago

How can I use a clickdetector to register when someone left clicks, when it registers the click I want it to turn the part the clickdetector and script is in to transparency = 1.

I've got some of my script this time, I think its what it should be but its not working:

MouseClick:connect(function(
 wait(1)
 script.Parent.Transparency = 0.9
end?

1 answer

Log in to vote
0
Answered by
CodyDev 70
6 years ago

Code:

script.Parent.MouseClick:Connect(function() -- Make sure this script is a child of the clickdetector
 wait(1)
 script.Parent.Parent.Transparency = 0.9
end)

MouseClick isn't recognized as an event in that script because you aren't telling the script what it's from. You must first add the path to the ClickDetector.

Also, I fixed the function.

1
Thank you! HeadlessGuide 16 — 6y
Ad

Answer this question