Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to get ClickDetectors to work?

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

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)

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

This discussion is preserved as it was. New answers, comments, and votes are closed.