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:

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

Anyway here is the answer:

01local adminReward = script.Parent.Parent.Parent
02local adminNameHolder = Script.Parent
03 
04if 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! :) --]]
05 
06    adminNameHolder.Text = "Hey M!"
07    adminReward.Enabled = true
08elseif game.Players.LocalPlayer.UserId == "548321187" then
09 
10    adminNameHolder.Text = "Hey L!"
11    adminReward.Enabled = true
12 
13elseif game.Players.LocalPlayer.UserId == "131427586" then
14 
15    adminNameHolder.Text = "Hey W!"
16    adminReward.Enabled = true
17 
18end

Hopefully it helped!

Ad

Answer this question