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

if game.Players.UserId no work??

oki so i was doing me game and made a gui for owner and friends only, so i put this:

if game.Players.LocalPlayer.UserId == 465503864 or 455637604 then
	game.Players.LocalPlayer.PlayerGui.painelowner.Enabled = true
end

but it give error on the line 1 why?

2 comments

0

What is the error saying?

0

And it should probably be game.Players.Player.userId

1 answer

✓ Accepted answer

Hey! So, your mistake was pretty simple. While using the 'or' function, you must repeat it all over again, so basically:

if plr.UserId == 465503864 or plr.UserId == 465503864 then

But, there's even a better way to do this! You can use the table.find function.

local plr = game.Players.LocalPlayer -- Defining 'plr' as the local player.
local userIDs = {"465503864 ","455637604"} -- A table named 'userIDs'.
if table.find(userIDs, plr) then -- If it finds in the table 'userIDs' the local player's userId then it will continue.
	plr.PlayerGui.painelowner.Enabled = true
end

2 comments

0

it worked!!! thansk!!!

0

Glad to know that I could help :D

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