Roblox Studio error

attempt to call a table value

What attempt to call a table value means in Roblox Studio, the four things that cause it with the code that triggers each, and the fix for each one.

Updated 5 November 20264 min readErrorLuauWritten by

In short

Brackets after a name, like Shop(), mean "run this function". Luau looked at Shop, found a table instead of a function, and stopped. The word after a is the type it found: table, string, number, Instance (a Roblox object) or RBXScriptSignal (an event). The fix is always the same idea: call the function that lives inside that value, not the value itself.

  • A ModuleScript usually returns a table of functions. Call Shop.buy(), not Shop().
  • An event is not a function: write part.Touched:Connect(onTouched), not part.Touched(onTouched).
  • If the message says nil value instead, the name points at nothing at all: see attempt to call a nil value.
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)
ServerScriptService.Shop:4: attempt to call a table value

Other forms of the same message:

  • attempt to call a string value
  • attempt to call a number value
  • attempt to call a Instance value
  • attempt to call a RBXScriptSignal value

Only functions can be called. Tables, text, numbers and Roblox objects hold data, so putting () after them has nothing to run. Luau names the type it found, which tells you what the variable really holds at that moment.

The line number in the message points at the call. Read the name just before the ( on that line: that name holds a table (or a string, a number, an object) when the line runs.

Causes and fixes

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

Calling a ModuleScript instead of a function inside it

A ModuleScript returns one value, usually a table such as local Shop = {} with functions added to it. require gives you that table. Calling it with Shop() calls the table.

Breaks Script in ServerScriptService named Shop
local Shop = {}

function Shop.buy(itemName: string)
	print("bought", itemName)
end

local module = Shop
-- the table itself is called: attempt to call a table value
module("Sword")

Call the function by its name inside the table, with a dot (or a colon if the module was written with function Shop:buy()).

Fixed Script in ServerScriptService named Shop
local ServerScriptService = game:GetService("ServerScriptService")

local Shop = require(ServerScriptService:WaitForChild("ShopModule") :: ModuleScript) :: any
Shop.buy("Sword")

If you want Shop("Sword") to work, make the ModuleScript return a function instead of a table. Most modules return a table because they hold more than one function. The ModuleScripts section of the client and server guide covers what require returns.

Calling an event instead of connecting to it

Events such as Touched, PlayerAdded and MouseButton1Click are RBXScriptSignal values. You do not call them; you connect a function to them. Writing part.Touched(onTouched) gives attempt to call a RBXScriptSignal value.

Breaks Script in ServerScriptService named Lava
local part = workspace:WaitForChild("Lava") :: BasePart

local function onTouched(hit: BasePart)
	print(hit.Name, "touched the lava")
end

-- attempt to call a RBXScriptSignal value
;(part.Touched :: any)(onTouched)

Use :Connect with a colon. The function runs every time the event fires.

Fixed Script in ServerScriptService named Lava
local part = workspace:WaitForChild("Lava") :: BasePart

local function onTouched(hit: BasePart)
	print(hit.Name, "touched the lava")
end

part.Touched:Connect(onTouched)

A variable with the same name as a function

A function and a table (or a string) cannot share a name. If local settings = {} comes after local function settings(), or a loop variable reuses the name, the newer value hides the function, and the next call finds the table.

Breaks Script in ServerScriptService named Rewards
local function reward(player: Player)
	print("rewarding", player.Name)
end

-- later, the same name is reused for a table of numbers
local reward = { coins = 10, gems = 1 }

for _, player in game:GetService("Players"):GetPlayers() do
	-- attempt to call a table value
	(reward :: any)(player)
end

Give the data and the function different names. Studio's Script Analysis warns about a local that shadows another, so check it when you see this error.

Fixed Script in ServerScriptService named Rewards
local Players = game:GetService("Players")

local REWARD_AMOUNTS = { coins = 10, gems = 1 }

local function reward(player: Player)
	print("rewarding", player.Name, REWARD_AMOUNTS.coins, "coins")
end

for _, player in Players:GetPlayers() do
	reward(player)
end

Brackets after a property or a child

Properties and children are values, not functions: player.Name() calls a string, part.Size() calls a Vector3 and workspace.Door() calls an Instance. Functions of an object use a colon, such as part:Destroy().

Breaks Script in ServerScriptService named Welcome
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player: Player)
	-- Name is a string property: attempt to call a string value
	print("Welcome " .. (player.Name :: any)())
end)

Read a property without brackets. Use a colon and brackets only for methods, the functions listed under Methods on the class's page in the Roblox docs.

Fixed Script in ServerScriptService named Welcome
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player: Player)
	print("Welcome " .. player.Name)
end)

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: ServerScriptService.Shop:4: attempt to call a table value

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. Click the red line in Output. Studio opens the script at the line that made the call.
  2. Find the ( on that line and read the name just before it. That is the value that is not a function.
  3. Hover over the name in the Script Editor, or add print(typeof(name)) above the line and press Play, to see what it really holds.
  4. If it is a module, open the ModuleScript and look at its return line: the functions you can call are the ones inside the returned table.

Questions

What does attempt to call a table value mean?

You wrote brackets after a name, which tells Luau to run it as a function, but the name holds a table. Call a function inside the table instead, such as Module.doThing().

Why do I get it right after require?

Because require returns whatever the ModuleScript returns, usually a table. require(module)() calls that table. Store the result and call one of its functions.

What is the difference from attempt to call a nil value?

With nil, the name points at nothing: a typo, a function defined later, or a missing module function. With table, string or another type, the name holds a real value that just is not a function.

Can RoCode fix it?

Yes. Paste the Output line into RoCode. It reads the script and the modules it requires in your open place, finds what the name holds and rewrites the call.

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, 5 November 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked by running the first broken block on this page with the Luau CLI, which uses the same Luau VM as Roblox Studio, on 5 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.