Argument 1 missing or nilin Roblox Luau: what it means and how to fix it

What it means

A Roblox function needed a value in its first slot and got nil or nothing. The number tells you which argument to check.

The same error also shows up as:

  • Argument 2 missing or nil

The smallest script that triggers it

Triggers the errorline 4: error here
local ReplicatedStorage = game:GetService("ReplicatedStorage")
 
local itemName
local tool = ReplicatedStorage:FindFirstChild(itemName)

The fix

Fixedline 3: the fix
local ReplicatedStorage = game:GetService("ReplicatedStorage")
 
local itemName = "Sword"
local tool = ReplicatedStorage:FindFirstChild(itemName)

FindFirstChild needs a name to search for. Once the variable holds a string, the call has its first argument.

Common causes

  1. The variable passed in was never assigned.
  2. A value sent through a RemoteEvent arrived as nil, often because the receiving function forgot that player is the first parameter on the server.
  3. The name came from a lookup that found nothing, such as a missing attribute or table field.

Practice this until it sticks

A Deep Dive on function arguments and nil: 5-minute lessons, each with a quiz. What you miss comes back in the next module. One Deep Dive a day is free. No card.