You are comparing a single string to a table. What you need to do is compare the contents inside the table (strings) with the username string.
There are two ways to do this:
Firstly is a "for loop" with a regular table:
local Administrators = {
"Player1",
"Player2"
}
game.Players.PlayerAdded:Connect(function(player)
for _, adminName in pairs(Administrators) do
if player.Name == adminName then
print("Administrator")
end
end
end)
Another alternative is to use a dictionary:
local Administrators = {
["Player1"] = true,
["Player2"] = true
}
game.Players.PlayerAdded:Connect(function(player)
if Administrators[player.Name] then
print("Admin")
end
end)
This works because if the key (player name) exists in the dictionary of Administrator names, it will evaluate to true. If not, it will evaluate to nil
2 comments
By the way thats legit the end of the code because I haven't written the rest
Since you are using a table, maybe ipairs can help you. https://developer.roblox.com/articles/For-Loops#standard-library-iterators