Roblox Studio error

Expected ':' not '.' calling member function X

What Expected ':' not '.' calling member function X 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

Methods of Roblox objects, such as Destroy, FindFirstChild, WaitForChild and GetService, must be called with a colon: part:Destroy(). The colon passes the object itself to the method. With a dot, part.Destroy(), the method gets no object and stops with this error. The name at the end of the message is the method you called. Change the dot before it to a colon.

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.Cleanup:4: Expected ':' not '.' calling member function Destroy

Other forms of the same message:

  • Expected ':' not '.' calling member function FindFirstChild
  • Expected ':' not '.' calling member function GetService
  • Expected ':' not '.' calling member function WaitForChild

object:Method(a) is short for object.Method(object, a). Roblox methods need that first value to know which object to act on, so they check for it and throw this error when it is missing.

Properties and children still use a dot: part.Transparency, workspace.Map. Only calls to methods need the colon.

Causes and fixes

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

A dot instead of a colon

The most common case: typing . out of habit when calling a method. It is easy to miss because the line looks almost right.

Breaks Script in ServerScriptService named Cleanup
local part = workspace:WaitForChild("OldPlatform")

-- Expected ':' not '.' calling member function Destroy
part.Destroy()

Use a colon for the call. The Script Editor lists methods after a colon, so typing : also shows you the right names.

Fixed Script in ServerScriptService named Cleanup
local part = workspace:WaitForChild("OldPlatform")

part:Destroy()

The method was passed on its own

Passing part.Destroy to task.delay, Connect or a table of callbacks hands over the function without the part. When it runs later, it has no object, so it fails the same way.

Breaks Script in ServerScriptService named Cleanup
local part = workspace:WaitForChild("OldPlatform")

-- runs Destroy() with no part after 5 seconds:
-- Expected ':' not '.' calling member function Destroy
task.delay(5, part.Destroy)

Wrap the call in a function, so the method is called with its object when the time comes. task.delay also passes extra arguments, so task.delay(5, part.Destroy, part) works too.

Fixed Script in ServerScriptService named Cleanup
local part = workspace:WaitForChild("OldPlatform")

task.delay(5, function()
    part:Destroy()
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.Cleanup:4: Expected ':' not '.' calling member function Destroy

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

When do I use a dot and when a colon in Roblox?

A dot for properties, children and plain functions (part.Anchored, workspace.Map, math.floor(x), Vector3.new(1, 2, 3)). A colon for methods of an object (part:Destroy(), Players:GetPlayers()).

Why does my own module not show this error?

Only Roblox methods check for the object. A method you wrote with function Shop:Buy() and call as Shop.Buy() runs anyway, with self set to the first argument, and breaks later in stranger ways. Use the colon there too.

Is game.GetService("Players") wrong?

Yes, it gives this error with GetService. Write game:GetService("Players").

Can RoCode fix it?

Yes. Paste the Output line into RoCode. It opens the script in your place, changes the call and checks the rest of the file for the same slip.

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.