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

i get both player is admin and not admin, what?

i am trying to make a script for to check if a person is or is not admin

local player = script.Parent.Parent.Parent.Name
local players_allowed = {"jeremqpmfpi", "gosubtojerem_qpmfpi"}
print(players_allowed)

wait(1)
for index, player in pairs(players_allowed) do
	if player == players_allowed[1] then
		print("player is admin")
	end
	if player ~= players_allowed[1] then
		print("player is not admin")
	end
end

note:

it is in the player gui
i am jeremqpmfpi
i tried adding brackets to the "players_allowed[1]" in the if statements
also lua does tables 1 - 2 - 3 not 0 - 1 - 2 - 3

1 answer

It won't really work cuz it checks the player once. Instead, you can do

local player = script.Parent.Parent.Parent.Name
local players_allowed = {"jeremqpmfpi", "gosubtojerem_qpmfpi"}

wait()

for i, p in pairs(players_allowed) do
	if p.Name == players_allowed[1] then
		print("Admin")
	else
		print("Player")
end

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