I am making an admin system, and there are different admin ranks, in order to do this, I am using a table to assign a value to the admin’s user id:
local admins = {
{
ID = 1578920035,
Rank = 5
},
}
This has been working for me, but now it has stopped working and if I try printing the ID or Rank value using (print(admins.ID) for example, it prints nil, I can’t find anything about this on the wiki or forum.
With the way you have this setup, you can not just do “print(admins.ID)”. You instead need to do something like this (if this example is your real layout):
Well, you can first of get the entire admins count by doing #admins then you can index any of the number that is lower than the count. This way should work. Also you could do it with for i = 1, #admins
Yes for some reason I created another separate script in the same baseplate and it worked, I am going to search through all the code to try and find the source.
I seemed to have found the code responsible for it, the point of the code is to insert an int value into the player to make it easier with getting the player’s rank, but for some reason it is crashing the admin script.
--------------------------------------------
--Inserting the admin rank into the player--
--------------------------------------------
game.Players.PlayerAdded:Connect(function(player)
local rankValue = Instance.new("IntValue", player)
rankValue.Name = "Rank"
end)
while wait() do
for i, id in pairs(admins) do
local player = game.Players:GetPlayerByUserId(id.ID)
player.Rank.Value = id.Rank
end
end