I’m trying to create a custom icon system, however, I want the icon to be placed right next to the playerlist entries. So I decided to edit it in a way which allows me to see this, but in reality, the icon just doesn’t show up. It exists, as shown through the screengui hierarchy.
Below you will find the code made to make this happen, and also a screenshot of the hierarchy.
function IconsManager.UpdatePlayerIcon()
for _, player in pairs(game.Players:GetPlayers()) do
local playerFrame = PlayerList:FindFirstChild(player.Name .. "_Frame")
if playerFrame then
local iconSet = false
local iconFrame = playerFrame:WaitForChild("iconFrame")
local backgroundColor = iconFrame.BackgroundColor3
if SettingsManager.Settings.groupRanks.enableGroupRanks and SettingsManager.Settings.groupRanks.groupID then
local rankInGroup = player:GetRankInGroup(SettingsManager.Settings.groupRanks.groupID)
local rankData = SettingsManager.GroupRanks[rankInGroup]
if rankInGroup and rankData then
iconFrame.Icon.Image = rankData.icon
iconSet = true
end
end
if player.Team then
local whichTeam = tostring(player.TeamColor)
local teamData = SettingsManager.Team[whichTeam]
if teamData then
iconFrame.Icon.Image = teamData.icon
iconFrame.Icon.ImageColor3 = teamData.color
iconSet = true
end
end
if not iconSet then
local isFriend = IconsManager.IsFriendOfCurrentPlayer(player)
local EF = 17390341
local defaultIcon = ""
local defaultColor = (backgroundColor.R + backgroundColor.G + backgroundColor.B) / 3 > 0.5 and Color3.new(0, 0, 0) or Color3.new(1, 1, 1)
if isFriend then
defaultIcon = "rbxassetid://14724599020"
elseif player:GetRankInGroup(EF) >= 3 then
defaultIcon = "rbxassetid://15533016053"
end
iconFrame.Icon.Image = defaultIcon
iconFrame.Icon.ImageColor3 = defaultColor
iconSet = true
end
iconFrame.Icon.Visible = iconSet
end
end
end