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

I'm trying to get a click Detector script to work. But how?

Asked by
Moosee 62
10 years ago

When I try to make a click detector script. I always get an error, how do I make it work?

Please help!

Here is what I have or what I think:

function onClicked.Clickdetector()

4 answers

Log in to vote
1
Answered by
Mr1Vgy 30
10 years ago

Here is what you do:

function onClicked()
--code
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Ad
Log in to vote
3
Answered by 10 years ago

Hi, I recommend reading this small article. It will help your understanding a lot! Please vote this answer up if it helped you, and accept my answer if it works out in the end!

wiki.roblox.com/index.php/Making_an_onClicked_script

0
Thank you so much! I would upvote but I don't have 1 rep! Moosee 62 — 10y
1
you do now ;) and remember to check the wiki for basic scripting :) Shaydesilva 85 — 10y
1
Done! Thanks! This helped me so much! I figured out how to create a disco floor! Moosee 62 — 10y
0
great job! Shaydesilva 85 — 10y
Log in to vote
0
Answered by
Qxest 25
10 years ago

You can also do this:

script.Parent.TouchDetector.MouseClick:connect(function()
--What you want to happen when clicked
end

Log in to vote
0
Answered by 4 years ago

This is what I do:

ClickDetector = script.Parent

ClickDetector.MouseClick:connect(function(CanCollide)
workspace.Part.CanCollide = false
end

Just so you know, this is just an example.

Answer this question