This is not fill out but it would have their name PlayerID and Clearance level filled in. But my code above prints nil for some reason, It should print they’re Id but it prints nil
table.find won’t work because you’re actually using dictionaries, which have a custom key for an element. This means you can’t index elements like you would a table as the elements not are indexed by incrementing integers. You could instead get elements with Name["Name"] or Name.PlayerId (both ways of indexing work, but I think the first is more readable).
Also, I think that using a table of dictionaries is over complicating your implementation. You should use a single dictionary instead. Something like this:
local PlayerInfo = {
[player.UserId] = { -- Use UserId as the key as they are unique and immutable
["Name"] = "Name",
["ClearanceLevel"] = "??"
};
}
Then you can loop through the dictionary with
for userId, info in pairs(PlayerInfo) do
print("The clearance level for " .. info["Name"] .. " is " .. info["ClearanceLevel"])
end
And you can easily index any player’s information with
o my bad didn’t see that, I just read the original post and find problems with it. Thank you for pointing it out though, I didn’t know table.find() doesn’t work with that.