Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does "Argument 1 missing or nil" mean? It pops up when I use FindFirstChild.

Asked by 6 years ago

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)
0
which line... 0msh 333 — 6y
0
line 23 starwars5251977 48 — 6y
0
The variable is already a string, so it would be: if v ~= "Pickle", and: FindFirstChild(v) UgOsMiLy 1074 — 6y
0
You're not checking if the tool is there. <-> TheeDeathCaster 2368 — 6y

Answer this question