I'm making a game that needs to delete EVERYTHING in the player's backpack once the map has deleted, but it deletes everything except what the player is holding.. How do I fix this??
Here is the script:
for key = 1, #players do -- Increment the key variable every iteration until it reaches the amount of players local value = players[key]; -- Create a reference to the player value.Backpack:ClearAllChildren(); -- Clear their backpack end
for _,v in pairs(plr.Character:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end
An easier alternative to what @Happywalker did would to use the:UnequipTools()
for key = 1, #players do local value = players[key] if value.Character and value.Character:FindFirstChild('Humanoid') then value.Character.Humanoid:UnequipTools() end value.Backpack:ClearAllChildren() end