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

ClickDetector doen't work, can anyone help?

Asked by 5 years ago
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

Log in to vote
0
Answered by
Rinextel 291 Moderation Voter
5 years ago
Edited 5 years ago

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!

0
ummm why do we do (function(player) instead of (function() i dont get it HappyTimIsHim 652 — 5y
0
HappyTimIsHim it's optional. With Function(player) you can pass player who clicked as an argument to the funtion. GooierApollo664 183 — 5y
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) GooierApollo664 183 — 5y
0
You don't need remote events for that. Whatever code is in the OnServerEvent simply do in the MouseClick User#19524 175 — 5y
1
if I do that then exploiters will be able to exploit their Purchases GooierApollo664 183 — 5y
Ad

Answer this question