My Tool Save Script is not working

If this is the issue, give yourself a weapon while playing and see if it saves

1 Like

Sorry for the late response, but yes I have had a new tool to save the entire time and none of the time it was saved. I hope this helps resolve the issue.

This is a new error that I found.

1 Like

Sorry, What does the script look like now

local dss = game:GetService("DataStoreService")

local toolsDS = dss:GetDataStore("ToolsData")

local toolsFolder = game.ServerStorage.ToolsFolder

game.Players.PlayerAdded:Connect(function(plr)

	local toolsSaved = toolsDS:GetAsync(plr.UserId .. "-tools") or {}

	for i, toolSaved in pairs(toolsSaved) do

		if toolsFolder:FindFirstChild(toolSaved) then 

			toolsFolder[toolSaved]:Clone().Parent = plr.Backpack
			toolsFolder[toolSaved]:Clone().Parent = plr.StarterGear 
		end
	end

	plr.CharacterRemoving:Connect(function(char)

		char.Humanoid:UnequipTools()
		local tableOfTools = {}
		for i, v in pairs(plr.Backpack:GetChildren()) do
			table.Insert(tableOfitems,v.Name,#tableOfitems+1)
		end 
		toolsDS:SetAsync(plr.UserId .. "-tools", tableOfTools)
	end)
end)

Oh I thinks it’s because in line 25 ’ table.Insert(tableOfitems,v.Name,#tableOfitems+1), ‘tableOfitems’ doesn’t exist, save it to TableOfTools