I am trying to print "Player" and "PreyStar" from the table below but Idk how to. Thanks for the help!
Admins = {['Player'] = true, ['PreyStar'] = true}
print(Admins[1].Name)
I am trying to print "Player" and "PreyStar" from the table below but Idk how to. Thanks for the help!
Admins = {['Player'] = true, ['PreyStar'] = true}
print(Admins[1].Name)
local Admins = {['Player'] = true, ['PreyStar'] = true} --a table of admins
for i, v in pairs(Admins) do --cycle through all values in the table, where i = index and v = value.
print(i) --print the index, or name of the player.
end
Note this is not recommended if you are trying to make an admin script, as people can change usernames. it's better to use the player's id over their username. You can find the id, as it is a property of the player.
local id = game.Players.Player.userId
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
... you mean to print the index of a dictionary? Why would you?
I guess I mean that... I want to know how to print it.