This script is to basically clone the player's backpack into game.Lighting.Game_Tools
then clear the player's backpack, wait about 10 seconds, and give the player's backpack back.
tools = {"AK14", "Pistol", "Shotgun"} player = game.Players.LocalPlayer for a,b in pairs(game.Players:GetPlayers()) do for i,v in pairs(b.Character:GetChildren()) do if v:IsA("Tool") then k = player.Backpack:Clone().Parent = game.Lighting.Game_Tools b.Backpack:ClearAllChildren() wait(10 for i = 1,#tools do game.Lighting.Game_Tools:FindFirstChild(tools[i]):Clone().Parent = player.Backpack game.Lighting.Game_Tools:FindFirstChild(tools[i]):Clone().Parent = player.Backpack game.Lighting.Game_Tools:FindFirstChild(tools[i]):Clone().Parent = player.Backpack game.Lighting.Game_Tools:FindFirstChild(tools[i]):Clone().Parent = player.Backpack end end end
Any help please?
First you'll need to put it in a server script in the workspace or what ever you want but not in the player.
We'll make it a little more clean before and fix your error, I mean put the ends where you forgot to put it.
Second, we'll add theses events for make your Game_Tools
more cleaner and we'll do for when the player leave the folder get destroy, without that you can get so many folder when the player left and It can make it glitch.
After, we'll create the main function and put the body in.
Finally, we run the function with a loop for while 60 secondes your function will run.
--local tools = {"AK14", "Pistol", "Shotgun"}--I don't know what you want to do with that so I comment it. local newParent = game.Lighting["Game_Tools"] game.Players.PlayerAdded:connect(function(player) local playerSlot = Instance.new("Folder", newParent) playerSlot.Name = player.Name end) game.Players.PlayerRemoving:connect(function(player) local playerSlot = newParent:FindFirstChild(player.Name) if playerSlot then playerSlot:remove() end end) function main() for _, player in pairs(game.Players:GetPlayers()) do local backpack = player:WaitForChild("Backpack") for _, tool in pairs(backpack:GetChildren()) do if tool:IsA("Tool") or tool:IsA("HopperBin") then tool.Parent = newParent end end end wait(10) for _, playerSlot in pairs(newParent:GetChildren()) do local player = game.Players:FindFirstChild(playerSlot.Name) if player then local backpack = player:WaitForChild("Backpack") for _, tool in pairs(playerSlot:GetChildren()) do tool.Parent = backpack end end end end while true do wait(60) --Wait 60 secondes before run the function main() end
enjoy !