roblox click detector local script code example
Example 1: lua click detection
local clickDetector = workspace.Part.ClickDetector
function onMouseClick()
print("You clicked me!")
end
clickDetector.MouseClick:connect(onMouseClick)
Example 2: how to know who clicked a click detector roblox
function GoGoGo()
print("executing some code")
print("code code code")
error("error!!")
end
script.Parent.ClickDetector.MouseClick:Connect(GoGoGo)