Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with looping through tables index?

Asked by 8 years ago
local admins = {"Player1", "Player2"}

for _, v in pairs(admins) do
    if player.Name == v then
        adminButton.Visible = true
    else 
        break
    end
end

For some reason, this only works for Player1. If I swap them around in the table, then it works for Player2 but not Player1, so it seems to only work for whoever is first in the table. I got it loop through the table, but it doesn't seem to work properly. Any help?

Answer this question