Tool.Equipped not working

Every time I try to verify if the player is using the tool, it doesn’t work.

local StPack = game:GetService('StarterPack')
local Tool = StPack:WaitForChild('Tool')

local BlocksFolder = workspace:WaitForChild('Blocks')

Tool.Equipped:Connect(function(mouse)
     --continued code
end)

I tried printing with RequiresHandle off, but I don’t notice any problems or prints.

That’s because you’re using the StarterPack to find if the tool is Equipped or not, which is wrong.

Think about the StarterPack as something like this: it is a place where you put every tool you want the Player to spawn with, and all these tools are cloned into the Player’s backpack. This means that the tool the Player actually has and the tool inside of the StarterPack are two different items.

This means you have to use the .Equipped event on the tool in the Player’s Backpack, instead of the StarterPack. To achieve this, you can take two different approaches:

  1. Place a Script inside the Tool itself, and use script.Parent.Equipped to detect when it has been equipped.
  2. Place a Script somewhere else, and reference the player’s backpack when trying to detect if the tool has been equipped, such as:
local plr = game.Players.LocalPlayer
local tool = plr.Backpack:WaitForChild("Tool")

tool.Equipped:Connect(function()
-- code here
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.