I have a script that seems to only delete tools located in StarterPack. Whenever I insert a tool into a player's backpack, the tool is not deleted. I've tried putting the variables inside the function but it still does not work. Are there any solutions for this and if so, how would I do it?

wait()

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
local Backpack = Player:FindFirstChild("Backpack")

Humanoid.Died:connect(function()
    for i,v in pairs(Backpack:GetChildren()) do
        if v:IsA("Tool") and v:FindFirstChild("Handle")then
            v:Destroy()
        end
    end
end)

2 comments

0

what is the output error you get?

0

There is no output error. The script runs, it's just that it's only removing the tools that are in StarterPack. I am trying to remove the tools that are cloned from ServerStorage as well.