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