How do make a refresh script that can save your tools

so uh i have this refresh script that can refresh your character. but it removes your tools with it so how do i make it so that it wont remove your tools

this is the script

script.Parent.OnServerEvent:Connect(function(player)
	local re = Instance.new("Part",game.Workspace)
	re.CFrame = game.Workspace[player.Name].Torso.CFrame
	re.Anchored = true
	re.Transparency = 1
	re.CanCollide = false
	player:LoadCharacter()
	game.Workspace[player.Name].Torso.CFrame = re.CFrame
	wait(0.1)
	re:Destroy()
end)

Can you just put them in the player’s StarterGear | Roblox Creator Documentation?

1 Like

Example

function Refresh(Player)
	--Get character and HRP
	local Character = Player.Character
	if not Character then return end
	local HRP = Character:FindFirstChild("HumanoidRootPart")
	if not HRP then return end
	
	--Remember their og location and tools
	local frame = HRP.CFrame
	local tools = {}
	for i,v in pairs(Player.Backpack:GetChildren()) do
		table.insert(tools,v:Clone())
	end
	for i,v in pairs(Character:GetChildren()) do
		table.insert(tools,v:Clone())
	end
	
	--Spawn em in
	Player:LoadCharacter()
	
	--Wait for new char
	if not Player.Character then Player.CharacterAdded:Wait() end
	HRP = Player.Character:WaitForChild("HumanoidRootPart")
	
	--Set new position and give em their tools
	HRP.CFrame = frame
	for i,v in pairs(tools) do
		v.Parent = Player.Backpack
	end
end
1 Like