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()
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()
Here is what you do:
function onClicked()
--code
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
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
You can also do this:
script.Parent.TouchDetector.MouseClick:connect(function()
--What you want to happen when clicked
end
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
Thank you so much! I would upvote but I don't have 1 rep!
you do now ;) and remember to check the wiki for basic scripting :)
Done! Thanks! This helped me so much! I figured out how to create a disco floor!
great job!