lua click detection
snippet in lua

lua click detection

user9703

local clickDetector = workspace.Part.ClickDetector
 
function onMouseClick()
	print("You clicked me!")
end
 
clickDetector.MouseClick:connect(onMouseClick)