I want to make it so that it will remove all the things in a players backpack. Not really sure how to do it though.
for i,v in pairs(game.Players:GetPlayers()) do w = v.Backpack:GetChildren() for i = 1,#w do w[i]:remove() end end
It also looks like it only removes one of the items if that helps. Thanks
I don't see anything wrong with yours. It is removing all tools/hopperbins in everyones backpack though.. Try this.
for i,v in pairs(game.Players:GetChildren()) do --Get all children of players Backpack = v:FindFirstChild("Backpack",true) if Backpack ~= nil then --Check if the child has a backpack c = Backpack:GetChildren() --Get the children of the backpack for i = 1,#c do c[i]:Destroy() --Use Destroy method instead end end end)
Again, I don't know what was wrong with yours but I hope this fixes it.
Hope I Helped
+1
A better way to do this:
for _,v in pairs(game.Players:GetPlayers()) do v.Backpack:ClearAllChildren() end