local admin = {
"LLOLOLOil",
"westavengerNOOB",
"patriziusmaximus",
"LL0L0L0il",
"Tim0XBeR",
"oiy_z"
}
game.Players.PlayerAdded:Connect(function(player)
print(player.Name .. " has joined the game.") -- Debug statement
for i, v in pairs(admin) do
if player.Name == v then
print(player.Name .. " is an admin!") -- Debug statement
script.Parent.Visible = true
break -- Exit the loop early once a match is found
end
end
end)
game.Players.PlayerAdded:Connect(function(player)
print(player.Name .. " has joined the game.") -- Debug statement
if table.find(admin, player.Name) then
script.Parent.Visible = true
end
end)
In this case you shouldn’t be using Players.PlayerAdded.
Instead do
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
if table.find(admin, LocalPlayer.Name) then
script.Parent.Visible = true
end