Safe System Not Giving Weapon Back

You can write your topic however you want, but you need to answer these questions:
Hello I am trying to use a safe system kit for my game it lets me put items in and it saves but I can’t put it back in my inventory

This Is The Code In The Serverscriptservice

local dataStore = game:GetService("DataStoreService"):GetDataStore("InvDataStore2")
local remote = game:GetService("ReplicatedStorage"):WaitForChild("Inventory")

function saveData(plr)
	local findFolder = plr:FindFirstChild("InvData")
	if findFolder then
		local saveTable = {}
		for i, v in pairs(findFolder:GetChildren())do
			saveTable[#saveTable + 1] = v.Name
		end
		dataStore:SetAsync(plr.UserId, saveTable)
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	
	local folder = Instance.new("Folder", plr)
	folder.Name = "InvData"
	
	local getData
	local success, errorm = pcall(function()
		getData = dataStore:GetAsync(plr.UserId)
	end)
	
	if success and getData then
		for i, v in pairs(getData) do
			local x = Instance.new("IntValue", folder)
			x.Name = v
		end
	elseif errorm then
		error(errorm)
	end
	
end)

game:BindToClose(function()
	for i, plr in pairs(game.Players:GetChildren())do
		saveData(plr)
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	saveData(plr)
end)

remote.OnServerEvent:Connect(function(plr, val, itemName, location)
	if val == "Change" then
		if location == "Backpack" then
			local find = plr.Backpack:FindFirstChild(itemName)
			if find then
				local x = Instance.new("IntValue", plr:WaitForChild("InvData"))
				x.Name = itemName
				find:Destroy()
			end
		elseif location == "Inv" then
			local find = game:GetService("ReplicatedStorage"):WaitForChild("Items"):FindFirstChild(itemName)
			if find then
				find:Clone().Parent = plr.Backpack
				plr:WaitForChild("InvData"):FindFirstChild(itemName):Destroy()
			end
		end
	end
end)

I reply really quick if you need me to show you more I can I just really want a fix.

1 Like