I have been trying to figure this out for 3 days. I'm creating a minigame, and I was easily able to add the tools, but removing them has been my problem. I've manipulated this little line of code forever and just cannot figure it out, if someone can help and give me a brief explanation of my problem that would be awesome. Here's the code:
toolboxy = game.Players.Character:GetChildren() wait(3) game.Player.Character.Backpack:ClearAllChildren()
Like I said, I'm a Beginner's scripter, and I've tried everything possible to my ability, I tried creating a table, doing for loops, nothing. So, if someone can help I'll give you rep. Thanks!
plrs = game.Players:GetChildren() for i,v in pairs(plrs) do v.Backpack:Destroy() end
If you want to actually clear the Backpack instead of removing it...
plrs = game.Players:GetChildren() for i,v in pairs(plrs) do v.Backpack:ClearAllChildren() end
-Thank me by accepting this answer/bumping up my reputation!
You need to remove everything from the Backpack and check for equipped tools in the player's character. You also have to loop through character to access items, you can't just say :GetChildren(), that just makes a table.
for i,v in pairs(game.Players:GetPlayers()) do for a,b in pairs(v.Character:GetChildren()) do if b:IsA("Tool") or b:IsA("HopperBin") then b:Destroy() end end v.Backpack:ClearAllChildren() end