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

i have problems with 'Expected identifier when parsing function name, got '('? [SOLVED!]

Hello!

I'm scripting a game but the whole thing does'nt work because of a that '(' at line 4. Does someone knows why?

MenuObby.MouseButton1Click:Connect(function()
	script.Parent.Loading.Visible = true
	Menu.Visisble = false
	function(Player)
		game.GetService('TeleportService'):Teleport(ObbyId, Player)
	end
end)

This is the error message:

Players.alexerooo4.PlayerGui.Screengui.MenuScript:44: Expected identifier when parsing function name, got '('

Pls someone help me! Otherwise i need to stop the project...

Thanks, alexerooo4 - Programmer of the game 'Cube.'

1 answer

✓ Accepted answer

Identifiers

In programming, an Identifier is a user-defined name given to various different coding aspects such as variables functions and more...

Here, you've instantiated an anonymous function. Through the given context, it's application isn't appropriate. Therefore the compiler is expecting you to assign an identifier to your function:

function name(Player)
	game:GetService("TeleportService"):Teleport(ObbyId, Player)
end

1 comment

0

Thank you!

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