Roblox Studio error

require(assetId) cannot be called from a client

What require(assetId) cannot be called from a client means in Roblox Studio, the two things that cause it with the code that triggers each, and the fix for each one.

Updated 12 November 20263 min readErrorLuauWritten by

In short

require(123456789) loads a ModuleScript published on Roblox by its asset ID, and only the server may do that. A LocalScript that tries gets this error. Insert the module into your place instead, put it in ReplicatedStorage, and require the instance: require(ReplicatedStorage:WaitForChild("MyModule")). That works on both sides and you can read the code you are running.

On this page
  1. What it means
  2. Causes and fixes
  3. Fix it with RoCode
  4. Find the line
  5. Questions
  6. Sources

What the message means

Output (example)
Players.Player1.PlayerScripts.Loader:3: require(assetId) cannot be called from a client.  assetId = 123456789

The number after assetId = is the ID the script passed. Look it up on the Creator Store to see which module it is.

Requiring by ID on the server also runs code you cannot see in your place, and it can change whenever its owner updates it. Free models sometimes hide a require(id) for that reason.

Causes and fixes

Two things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.

A LocalScript requires a module by ID

Client code can only require ModuleScript instances it can see. An asset ID is not an instance.

Breaks LocalScript in StarterPlayer.StarterPlayerScripts named Loader
-- require(assetId) cannot be called from a client.  assetId = 123456789
local Effects = require(123456789)

Effects.start()

Get the module into the place once: insert it from the Toolbox (or with InsertService in the command bar), move it to ReplicatedStorage, and require it by its path.

Fixed LocalScript in StarterPlayer.StarterPlayerScripts named Loader
local ReplicatedStorage = game:GetService("ReplicatedStorage")

type EffectsModule = { start: () -> () }
local Effects = require(ReplicatedStorage:WaitForChild("Effects")) :: EffectsModule

Effects.start()

A free model hides a require by ID

A model from the Toolbox can include a script with require(id). In a LocalScript it shows this error; in a server Script it quietly runs outside code in your game.

Breaks LocalScript in a model in Workspace named Script
-- found inside a Toolbox model
local id = 123456789
require(id)

Delete the script unless you know exactly what that module does. Search the whole place for require( followed by a number, from the Find All window (Ctrl+Shift+F, or Cmd+Shift+F on Mac).

Fixed LocalScript in a model in Workspace named Script
-- the loader was deleted; the model keeps only its own parts and scripts
print("Loaded", script:GetFullName())

Fix it in your place

Paste the error, RoCode fixes it in your place

Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.

For example: Players.Player1.PlayerScripts.Loader:3: require(assetId) cannot be called from a client. assetId = 123456789

RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.

How to find the line that causes it

  1. Open Output (Window menu, or the Script tab), clear it with Ctrl+K (⌘K on Mac), and press Play.
  2. Find the first red line. It starts with the script's place in the Explorer and the line number, such as ServerScriptService.Shop:12:.
  3. Click the red line. Studio opens that script with the cursor on the failing line.
  4. Read the lines between Stack Begin and Stack End under it: they list the calls that led there, newest first, so you can see which function called the broken one.
  5. Still not sure which value is wrong? Add print(typeof(x), x) just above the line, or set a breakpoint on it and read the values in the Watch window.

Questions

Can a server Script require by asset ID?

Yes, if the module is yours or its owner made it available to require. It still runs code from outside your place, so inserting the module is usually better.

How do I share a module between the server and clients?

Put the ModuleScript in ReplicatedStorage. Server Scripts and LocalScripts can both require it there.

Is require(id) a backdoor?

It can be. Many backdoors in free models are a hidden require of a module that gives someone else control of your server. Remove any you did not add yourself.

Can RoCode fix it?

Yes. Paste the Output line into RoCode. It finds the require calls in your open place, and moves or removes them.

Sources and further reading

How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 12 November 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked against the message format strings in Roblox Studio itself (macOS build installed on 12 November 2026) on 12 November 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

More Roblox errors

All Roblox Studio errors

Stop hunting errors line by line.

RoCode reads the scripts in your open place, fixes the error where it happens and tells you what it changed. Free every day, no card required.