on clicked on lua 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: lua how to make a click to activate button
script.Parent.MouseButton1Click:Connect(function()
--What ever you want to do
end)