Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool not printing when clicked?

Asked by 4 years ago
Edited 4 years ago

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!

1 answer

Log in to vote
0
Answered by
JakyeRU 637 Moderation Voter
4 years ago
Edited 4 years ago

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.)

Ad

Answer this question