I get the error "Argument 1 missing or nil"... Code:

wait(2)

local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("PicklePointsSaveSystem54835723")

local player = game.Players.LocalPlayer

local tools = player.Backpack
local currentTools = {}

for i, v in pairs(tools:GetChildren()) do
	table.insert(currentTools, v.Name)
end

tools.ChildAdded:connect(function(object)
	table.insert(currentTools, object.Name)
end)

player.Character.Humanoid.Died:connect(function()
	repeat wait() until player.Character.Humanoid.Health == player.Character.Humanoid.MaxHealth
	for i, v in ipairs(currentTools) do
		if v.Name ~= "Pickle" then
			local tool = game.ServerStorage.Tools:FindFirstChild(v.Name)
			tool:Clone().Parent = player.Backpack
		end
	end
end)

4 comments

0

which line...

0

line 23

0

The variable is already a string, so it would be: if v ~= "Pickle", and: FindFirstChild(v)

0

You're not checking if the tool is there. <->