function saveWeapons(player) local bin = Instance.new("StarterGear") --Changed HopperBin to StarterGear bin.Parent = game.Lighting bin.Name = player.Name local stuff = player.Backpack:GetChildren() for i = 1,#stuff do local name = stuff[i].Name if game.StarterPack:findFirstChild(name)==nil then stuff[i]:Clone().Parent = bin end end local char = player.Character:GetChildren() for i = 1,#char do if char[i].className == "Tool" then local name = char[i].Name if game.StarterPack:findFirstChild(name)==nil then char[i]:Clone().Parent = bin end end end end function onRespawned(player) local findBin = game.Lighting:findFirstChild(player.Name) if findBin~=nil then local stuff = findBin:GetChildren() for i = 1,#stuff do stuff[i]:Clone().Parent = player.Backpack end findBin:Remove() end player.Character.Humanoid.Died:connect(function() saveWeapons(player) end) end function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onRespawned(newPlayer) end end) while true do if newPlayer.Character~=nil then break end wait() end newPlayer.Character.Humanoid.Died:connect(function() saveWeapons(newPlayer) end) end game.Players.PlayerAdded:connect(onPlayerEntered)
The tools still will not auto-save. Anyone know why this is? If anyone knows a auto-save script model already made would they be able to tell me if so? This has been bugging me for a long time and I still cannot figure it out.