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()
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:
1 | script.Parent.Touched:Connect( function |
2 | --Function goes here |
3 | end ) |
Anyway here is the answer:
01 | local adminReward = script.Parent.Parent.Parent |
02 | local adminNameHolder = Script.Parent |
03 |
04 | 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! :) --]] |
05 |
06 | adminNameHolder.Text = "Hey M!" |
07 | adminReward.Enabled = true |
08 | elseif game.Players.LocalPlayer.UserId = = "548321187" then |
09 |
10 | adminNameHolder.Text = "Hey L!" |
11 | adminReward.Enabled = true |
12 |
13 | elseif game.Players.LocalPlayer.UserId = = "131427586" then |
14 |
15 | adminNameHolder.Text = "Hey W!" |
16 | adminReward.Enabled = true |
17 |
18 | end |
Hopefully it helped!