How do I Save Tools

Hey there I hope you’re having a great day! So I’m working on a simulator and I can’t figure out how to save tools (no tutorials anywhere) so I just need to save the tool that’s in the players backpack. That’s it well thanks for reading have a nice day.

1 Like

I Can Reccomend a video but, It only saves when a player leaves.

1 Like

yeah thats what i need thx pls do

So It works like this, If the player gets it and they leave the server, It saves Forever.
Even if they join again and die. But, If they die before leaving it wont save.

Link to video:

1 Like

wait so if they die they lose it? is there a way to make it so even if they die they keep it?

just disable the reset button

(ignore this)

he wants it to be like if they die like they hit a lazer or somethin they still keep

1 Like

You have to Make A save on death.

do you have a datastore script in your game

Keep Inventory Script
local RespawnWith = {}
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if RespawnWith[Player.UserId] ~= nil then
			for Index, Value in pairs(RespawnWith[Player.UserId]:GetChildren()) do
				Value.Parent = Player.Backpack
			end
			RespawnWith[Player.UserId] = nil
		end
		local Humanoid = Character:WaitForChild("Humanoid")
		Humanoid.Died:Connect(function()
			local Tools = Instance.new("Folder")
			for Index, Value in pairs(Player.Backpack:GetChildren()) do
				if Value:IsA("Tool") then
					local Found = false
					for _Index, _Value in pairs(Tools:GetChildren()) do if Value == _Value then Found = true break end end
					if not Found then
						Value.Parent = Tools
					end
				end
			end
			for Index, Value in pairs(Character:GetChildren()) do
				if Value:IsA("Tool") then
					local Found = false
					for _Index, _Value in pairs(Tools:GetChildren()) do if Value == _Value then Found = true break end end
					if not Found then
						Value.Parent = Tools
					end
				end
			end
			RespawnWith[Player.UserId] = Tools
		end)
	end)
end)

i have a leaderboard datastore

does this save for when u come back?

No it only saves when you die and respawn

try this one

1 Like