hi thank you for your time and help i really appreciate it i have a simple problem i want to remove all tools from all players and then give it back to them when i want here is my code for doing it
local items=game.StarterPack:GetChildren() for ii,item in pairs(items) do item.Parent=ServerStorage:WaitForChild("itemholder") -- put's it into a model end
but t didn't work thank you if u have any idea please answer it.
The StarterPack is not the place where the Player's tools are stored, they move to the Player's Backpack after the game runs. To remove tools from all players, you can do this.
for _,player in pairs(game.Players:GetChildren()) do for _,tool in pairs(player.Backpack:GetChildren()) do tool.Parent = ServerStorage:FindFirstChild("itemholder") -- This way, the tools get mixed up with other players' tools. end end
This way, the tools get mixed up and you won't be able to give them back later, to fix this, you can add this in a server script:
local holder = ServerStorage:WaitForChild("itemholder") game.Players.PlayerAdded:Connect(function(player) local folder = Instance.New("Folder") folder.Name = player.Name folder.Parent = holder end) game.Players.PlayerRemoving:Connect(function(player) local folder = holder:FindFirstChild(player.Name) if folder then folder:Destroy() end end)
So, Your final script to remove all the tools from the players would be
for _,player in pairs(game.Players:GetChildren()) do for _,tool in pairs(player.Backpack:GetChildren()) do tool.Parent = ServerStorage:FindFirstChild("itemholder"):FindFirstChild(player.Name) -- This way, the tools wont get mixed up with other players' tools. end end