xxxxxxxxxx
function onClicked()
--code here
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
xxxxxxxxxx
function GoGoGo()
print("executing some code")
print("code code code")
error("error!!")
end
script.Parent.ClickDetector.MouseClick:Connect(GoGoGo)
xxxxxxxxxx
--LUA
--put the script as a child of a part
--make a click detectora child of the same part
--get click detector refrence
local clickDetector = script.Parent.ClickDetector
--create a function to be fired when the click detector is clicked
function onMouseClick()
--put your code here
print("You clicked me!")
end
--this "connects" the event that happens when you click the click detector
--to the function above
clickDetector.MouseClick:connect(onMouseClick)