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

Streamlining UserIds into List?

How would I make a sort of permissions list instead of adding "or 0"? I want to make it so there is a list of user ids, if it is on the list it makes a gui visible. This isn't the whole script and it all works, just want more streamlined functionality.

if gui.id.Value == 16212258 or 0 then
		gui.Frame.Visible = true

1 answer

✓ Accepted answer

Using a table that contains the list of userIds you could achieve this, by either doing the following

local list = { --Setting the index of the table that is the same as the userId to true
	[12345678] = true; -- And listing each as such, if you wish to avoid for loops
	[87654321] = true;
}
if list[userId] then
	-- action
end

or

local list = {12345678,87654321} -- Or holding a list of the userIds
if (function() for i, v in pairs(list) do if userId == v then return true end end return false end)() then
	-- action
end

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