Attempted to call require with invalid argument(s).What it means in Roblox Luau and how to fix it
What it means
require was given something that is not a ModuleScript. Most often the value is nil because the module was not found.
The smallest script that triggers it
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- The module is named "Utils"
local Utils = require(ReplicatedStorage:FindFirstChild("Util"))
The fix
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Utils = require(ReplicatedStorage:WaitForChild("Utils"))
FindFirstChild returned nil for the misspelled name. The correct name with WaitForChild hands require a real ModuleScript.
Common causes
- FindFirstChild returned nil because the name is wrong or the module has not replicated yet.
- The path points at a Folder, Script or LocalScript and not a ModuleScript.
- A LocalScript tried to require a module in ServerStorage or ServerScriptService, which clients cannot see.
Practice this until it sticks
A Deep Dive on ModuleScripts and require: 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.