Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make everything in backpack disapear? [UNSOLVED]

Asked by 10 years ago

Is it possible to make an item in your backpack, go away, so you have an empty backpack? Anything I need to know before trying?

1 answer

Log in to vote
0
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
10 years ago

You can iterate through all objects in the backpack and destroy each child, or use the ClearAllChildren method:

Game.Players["Player Name"].Backpack:ClearAllChildren();

Addition And to clear all players' backpacks:

local players = Game.Players:GetPlayers(); -- Get a table of all the players
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
0
How could I do it so its not just players. I want it so when an event happens, everything in every players backpack is cleared NinjoOnline 1146 — 10y
0
I altered my answers. I loop through and get each player and clear the children of their backpack. jakedies 315 — 10y
0
Need to be in localscript? NinjoOnline 1146 — 10y
0
Nope. But I suppose it could work in a localscript if filtering is not enabled. jakedies 315 — 10y
View all comments (2 more)
0
what is filtering enabled and how do I enable and disable? NinjoOnline 1146 — 10y
Ad

Answer this question