Hi there, I’ve been trying to make a custom playerlist including the player’s names, avatars, teams and make another TextLabel visible if the player has a certain group rank.
This is my code:
local PlayerList = script.Parent
local Template = script.Parent.playername
function clearList()
for _, item in pairs(PlayerList:GetChildren()) do
if item:IsA("Frame") then
item:Destroy()
end
end
end
function fillList()
clearList()
for _, player in pairs(game.Players:GetChildren()) do
if not PlayerList:FindFirstChild(player.Name) then
local frame = Template:Clone()
frame.Name = player.Name
frame.Username.Text = player.Name
frame.Team.Text = player.Team
if player:GetRankInGroup(5702291) >= 246 then
frame.Staff.Visible = true
end
if player:GetRankInGroup(5702291) >= 250 then
frame.Moderator.Visible = true
end
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size60x60
local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
frame.Avatar.Image = content
frame.Visible = true
frame.Parent = PlayerList
end
end
end
fillList()
while wait(1) do
fillList()
end
However, I’m getting the error:
To make it more clear, here are some pictures of the structure:
How’d I fix that error? Thanks in advance!