Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Workspace.Teleport1A.TeleportScript1A:15 help ?

I am trying to solve this error.

Workspace.Teleport1A.TeleportScript1A:15: ambiguous syntax (function call x new statement) near '('

2 comments

0

can you post the hole script?

0

Please show your script or your question will be moderated.

1 answer

You did not post a script but I see your issue.

You are probably doing something like this:

(this is just an example)

local num =  7/(2  +  1.5)

(function()
	--// ...
end)()

Lua does not know if you are trying to call 3.5, a number value. Or if line 3 is a new statement. Since it is in parenthesis and a number literal it allows you to do this:

(3.5)()

Which causes the error of "attempt to call a number value"

What you can do is remove any parenthesis, or use a semicolon to separate it, like so:

local num =  7/2 + 1.5 --// yes order of operations gets messed up, but you no longer get error

(function()

end)()

Or using a semicolon:


local num =  7/(2 + 1.5); --// No error and (2 + 1.5) has higher priority since in parenthesis !!!!! :DDDDD

(function()

end)()

This discussion is preserved as it was. New answers, comments, and votes are closed.