Hello, so I've figured out how to remove tools in backpack, but when you equip a tool it wont get deleted since it's no longer in the backpack, could somebody tell me what I'm missing?
local pack = player.Backpack local findSword = pack:FindFirstChild("ClassicSword") local Char = workspace:FindFirstChild("Player") local equippedSword = Char:FindFirstChild("ClassicSword") if findSword then findSword:Destroy() elseif equippedSword then print("sword is equipped!")
Instead of using Workspace:FindFirstChild(“Player) (which wouldn’t work anyway because it would be looking for a child of workspace named “Player”)
Use player.Character or player.CharacterAdded:Wait() to look for the character.
local pack = player.Backpack local findSword = pack:FindFirstChild("ClassicSword") local Char = player.Character or player.CharacterAdded:Wait() local equippedSword = Char:FindFirstChild("ClassicSword") if findSword then findSword:Destroy() elseif equippedSword then print("sword is equipped!")
try with function, then add script.Parent.Equipped:Connect(YourFunctionName)