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

How to get ClickDetectors to work?

Asked by
SirNoobly 165
10 years ago

For some reason click detectors won't work for me when testing on a server. It works fine in Play Solo but it won't do anything on a test server. Even if I use a ClickDetector I put in there before it still won't work on a server.

local cd = Instance.new("ClickDetector", script.Parent)

cd.MouseClick:connect(function(player)
    print(player.Name .. " Clicked me!")
end)

Even the example on the wiki doesn't work in a server...

2 answers

Log in to vote
1
Answered by 10 years ago

Your script should be inside the click detector, and the click detector in the part so your script should be something like this:

local cd = script.Parent

cd.MouseClick:connect(function()
    --insert code here
end)
Ad
Log in to vote
-1
Answered by 10 years ago

script.Parent.Clickdetector.MouseClick:conenct(function() print("Working") end)

Answer this question