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

How the clickdetector work?

Asked by 5 years ago

I still not learn anything about ClickDetector,I try basic script and it wont work

I watch on youtube how to do it but i still don't know the basic

This the script that i try

script.Parent.Parent.BrickColor = BrickColor.new("Baby blue")function Myfunction() workspace.Part.ClickDetector.MouseClick:Connect(Myfunction()

and the output give me this

Workspace.Part.ClickDetector.Script:4: ')' expected (to close '(' at line 2) near '<eof>'

1 answer

Log in to vote
2
Answered by 5 years ago
-- I will organize this for you...

workspace.Part.ClickDetector.MouseClick:Connect(function()
    script.Parent.Parent.BrickColor = BrickColor.new("Baby blue")
end)

I got rid of the function and replaced it with an event.. I put the script to change the brick color in the event

Ad

Answer this question