Roblox Studio error

attempt to call missing method 'X' of table

What attempt to call missing method 'X' of table 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

Shop:GiveCoins(player) looks up a function named GiveCoins in the Shop table and calls it. If there is no such function, Luau stops with attempt to call missing method 'GiveCoins' of table. Check the spelling against the function Shop:GiveCoins line in the module, check that the module defines it before you call it, and for objects made with setmetatable, check that the class sets __index.

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:9: attempt to call missing method 'GiveCoins' of table

Other forms of the same message:

  • attempt to call missing method 'Start' of table
  • attempt to call missing method 'new' of table

This is a sharper form of attempt to call a nil value: Luau knows you used a colon call, so it names the method that was missing.

Capital letters matter. giveCoins and GiveCoins are two different names.

Causes and fixes

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

The method name is spelt differently

The module defines AddCoins but the script calls GiveCoins, or the case differs.

Breaks ModuleScript in ServerScriptService named Coins
-- ServerScriptService.Coins (a ModuleScript)
local Coins = {}

function Coins:AddCoins(player: Player, amount: number)
    print(player.Name, "gets", amount)
end

-- elsewhere:
-- attempt to call missing method 'GiveCoins' of table
Coins:GiveCoins(game.Players:GetPlayers()[1], 10)

return Coins

Call the name the module really defines. Typing Coins: in the Script Editor lists the methods that exist.

Fixed ModuleScript in ServerScriptService named Coins
local Players = game:GetService("Players")

local Coins = {}

function Coins:AddCoins(player: Player, amount: number)
    print(player.Name, "gets", amount)
end

local first = Players:GetPlayers()[1]
if first then
    Coins:AddCoins(first, 10)
end

return Coins

The class never sets __index

Objects made with setmetatable({}, Class) find their methods through Class.__index. Without that line, every method call on the object fails.

Breaks Script in ServerScriptService named Pets
local Pet = {}

function Pet.new(name: string)
    return setmetatable({ name = name }, Pet)
end

function Pet:Greet()
    print("Hi from", self.name)
end

local dog = Pet.new("Rex")
-- attempt to call missing method 'Greet' of table
dog:Greet()

Set Pet.__index = Pet right after creating the class table.

Fixed Script in ServerScriptService named Pets
local Pet = {}
Pet.__index = Pet

type PetObject = typeof(setmetatable({} :: { name: string }, Pet))

function Pet.new(name: string): PetObject
    return setmetatable({ name = name }, Pet)
end

function Pet.Greet(self: PetObject)
    print("Hi from", self.name)
end

local dog = Pet.new("Rex")
dog:Greet()

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:9: attempt to call missing method 'GiveCoins' of table

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

What does 'of table' mean?

It is the type of the thing you called the method on. Your variable holds a table, but that table has no function under the name you used.

Does the order of functions matter?

Yes, at the top level of a script. A call that runs before the function Module:Name() line has run finds nothing yet. Put calls after the definitions, or inside functions that run later.

Why does it work on the class but not on the object?

Calling Pet:Greet() finds the function in Pet itself. An object made with setmetatable only finds it through __index.

Can RoCode fix it?

Yes. Paste the Output line into RoCode. It compares the call with the module in your place and fixes the name or the class setup.

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.