Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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()

0
Code blocks kingblaze_1000 359 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

Ad

Answer this question