Hi, I'm trying to make it so my script first unequips any tools they have open, then destroys them. I'd really like to make this work as having them NOT unequip first causes glitches with some animations and effects and what not for my games.
for _,v in pairs(p.Backpack:GetChildren()) do if v:IsA'Tool' or v:IsA'HopperBin' then v:UnequipTools() v:Destroy() end
the UnequipTools() function is used with the player's humanoid so lets do this
First let's use that function on the humanoid
local p = player --change this p.Character.Humanoid:UnequipTools()
Now let's remove all the player's tools in their backpack
local p = player --change this p.Character.Humanoid:UnequipTools() for _,v in pairs(p.Backpack:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end
We check that what we are destroying is a tool
Extra comments example:
local p = player --change this for _,v in pairs(p.Character:GetChildren()) do if v:IsA("Tool") then v.Parent=p.Backpack end end for _,v in pairs(p.Backpack:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end