Ight i need to know how to make a tool detect a script For example i want it to print "Hello"
How would i do so? i know its using :Mouse1Down but i have no idea how to get to the directory
help is appreciated, for anyone wondering what its for, i'm trying to make a script for Void script builder 2 and its my first one, anyway help is appreciated, sorry if this is technicly a "request" because i don't have a script but if you wanna help its appreciated :D
✓ ANSWER ACCEPTED
How do i make a tool click detector? please help :p
3 answers
✓ Accepted answer
Hello, Entity_246!
Sorry for the delay, I was playing a game. Below is a script you can use. All explanation is inside of this script.
local PlayerService = game:GetService("Players")
local Client = PlayerService.LocalPlayer
local Tool = script.Parent
local Equipped = false
function ButtonClick(PlayerMouse) -- the code that will run when they click
print('Hey')
end
function ToolEquipped(PlayerMouse) -- the code that will run while the tool is equipped
Equipped = true
PlayerMouse.Button1Down:Connect(function() -- Button1Down is used when the player click their left mouse button
if Equipped then
ButtonClick() -- the function that handles what code to run
end
end)
end
function ToolUnEquipped(PlayerMouse)
Equipped = false
end
Tool.Equipped:Connect(ToolEquipped)
Tool.Unequipped:Connect(ToolUnEquipped)
1 comment
0
Thank you so much i would upvote but i dont have enough rep :D
Put a local script inside of the tool with this
local Entity_246MSG = "Your Message Here" ---what is will say
script.Parent:Equipped:Connect(function()
print(Entity_246MSG) --printing the variable
end)
1 comment
0
This runs when the tool is Equipped. He wanted it to run something which is print("Hello") when the player clicks their left mouse button.
Okay, let's say you are making a sword and you want it to print "Hello World!" when activated.
You'd write this:
local tool = script.Parent
tool.Activated:connect(function()
print("Hello World!")
end)
Please let me know if that does not work.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I'm confused by what you mean. Do you mean when they have a tool equipped and they press down you want it to print hello?
yes, the tool equipped and when you click it prints a message, sorry that wasnt clear mb