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

How do i fix " Expected identifier when parsing expression, got )"?

I wanted to make a Gui that only appears for my friends, this is what i got so far, yet everytime i try to fix it it has the same output, Expected identifier when parsing expression, got ')' Here is what i have so far:

local adminReward = script.Parent.Parent.Parent local adminNameHolder = Script.Parent

if game.Players.LocalPlayer.UserID == "1371309169" then adminNameHolder.Text = "Hey M!" adminReward.Enabled = true else if game.Players.LocalPlayer.UserID == "548321187" then adminNameHolder.Text = "Hey L!" adminReward.Enabled = true else if game.Players.LocalPlayer.UserID == "131427586" then adminNameHolder.Text = "Hey W!" adminReward.Enabled = true end()

1 comment

0

Code blocks

1 answer

✓ Accepted answer

You added a () at the end in the "end" function. You are not supposed to do that at all in Lua. You can only write "end)" and it is only used when closing a function that starts with "(function". For example:

script.Parent.Touched:Connect(function
	--Function goes here
end)

Anyway here is the answer:

local adminReward = script.Parent.Parent.Parent 
local adminNameHolder = Script.Parent

if game.Players.LocalPlayer.UserId == "1371309169" then [[-- When typing "userid" in Roblox, you always have to write it like "UserId". This may not be true every time, but it is a learning experience that I got when trying to define "UserID". Hopefully, that tip helps in the future! :) --]]

	adminNameHolder.Text = "Hey M!" 
	adminReward.Enabled = true 
elseif game.Players.LocalPlayer.UserId == "548321187" then 

	adminNameHolder.Text = "Hey L!" 
	adminReward.Enabled = true

elseif game.Players.LocalPlayer.UserId == "131427586" then 

	adminNameHolder.Text = "Hey W!" 
	adminReward.Enabled = true 

end 

Hopefully it helped!

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