Hello! I am relatively new to scripting, and have been trying to learn more, and grasp more everyday! Today I have made a tool, in which is a script and a click detector. When you click, it's supposed to print a text, however, on click, nothing happens.
Here's the code:
function Click if script.Parent Click = true then print "test completed!" end end
Thank you!
Hello.
You have to use the Activated
event and a LocalScript.
script.Parent.Activated:Connect(function() print("Click!") end)
script is the Local Script.
Parent it's the Script Parent (The Tool.)
Activated it's an event of the Tool.
If you do not have a handle for your tool, make sure you set false tool's property RequiresHandle
.
Everything between script.Parent.Activated:Connect(function() and end) will run when you activate the tool (click.)