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

ClickDetector doen't work, can anyone help?

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	print("hay")
end)

This simple Local script doesn't work. No errors, nothing. It's like I'm not clicking at all, but I am.

1 answer

✓ Accepted answer

Here you go. Make sure that this script is NOT a Local Script and is put inside of the ClickDetector which should be inside of the part.

script.Parent.mouseClick:connect(function() -- LUA Script Noticing the click
	print("hay") -- Script responding to the click
end)

Hope this helps!

5 comments

0

ummm why do we do (function(player) instead of (function() i dont get it

0

HappyTimIsHim it's optional. With Function(player) you can pass player who clicked as an argument to the funtion.

0

Rinextel if I do that I will not be able to do this which is my main problem script.Parent.MouseClick:Connect(function(player) game:GetService("ReplicatedStorage").RemoteBuy:FireServer() end)

0

You don't need remote events for that. Whatever code is in the OnServerEvent simply do in the MouseClick

1

if I do that then exploiters will be able to exploit their Purchases

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