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(), notShop(). - An event is not a function: write
part.Touched:Connect(onTouched), notpart.Touched(onTouched). - If the message says
nil valueinstead, the name points at nothing at all: see attempt to call a nil value.
What the message means
ServerScriptService.Shop:4: attempt to call a table value
Other forms of the same message:
attempt to call a string valueattempt to call a number valueattempt to call a Instance valueattempt 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
- Calling an event instead of connecting to it
- A variable with the same name as a function
- Brackets after a property or a child
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.
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()).
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.
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.
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.
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.
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().
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.
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.
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
- Click the red line in Output. Studio opens the script at the line that made the call.
- Find the
(on that line and read the name just before it. That is the value that is not a function. - 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. - If it is a module, open the ModuleScript and look at its
returnline: 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
- Luau: syntax. function calls and method calls
- Roblox Creator Docs: ModuleScript. what require returns
- Roblox Creator Docs: RBXScriptSignal. Connect, Once and Wait
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.