I have been working on a FPS game where I need to save the guns, but when I go into the actual game the save script doesn't work. If anyone knows what is happening or how I can fix it, please let me know.

Script:

--Setup the DataStore
local ds = game:GetService("DataStoreService"):GetDataStore("Tools");
local tools = game.ServerStorage.ToolStorage; --Specify all possible tools

--{[Check and Load]}
game.Players.PlayerAdded:connect(function(plr)
	--Retrieve the potential data
	local data = ds:GetAsync(plr.UserId);
	--Check if it exists
	if data then
		--If it does, loop and clone respective tools.
		for _,v in next,data do
			local tool = tools:FindFirstChild(v);
			if tool then
				tool:Clone().Parent = plr.Backpack;
			end
		end
	end
end)

--{[Collect and Save]}
game.Players.PlayerRemoving:connect(function(plr)
	--Make a table to hold all the data
	local toolList = {};
	--Iterate through the backpack and fill the table in
	for _,v in next,plr.Backpack:GetChildren() do
		--Make sure it's actually a tool
		if v:IsA("Tool") or v:IsA("HopperBin") then
			toolList[#toolList+1] = v.Name;
		end
	end
	--Save the table
	ds:SetAsync(plr.UserId,toolList);
end)

Game: Shadow Ops