Specific Player Icons

I’ve built a custom playerlist and now I want to make it so I can differentiate normal players versus staff members. How would I go about this?

This is what I’ve already done:

local STAFF_MEMBERS = {
	[1645028151] = true,
	[-1] = true
}

How would I make it to check that if these people have joined the game, they get the staff icon next to their name using StaffIcon.Visible?

You can use table.Find for this.
For example:

local staffMembers = {"name1", "name2", "name3"}
staffMember = table.find(staffMembers, "game.Players.LocalPlayer.Name")
if staffMember then
	print("This user is a staff member")
end
local STAFF_MEMBERS = {
	[1645028151] = true,
	[-1] = true
}
local StaffIcon = -- Path to staff icon

game:GetService("Players").PlayerAdded:Connect(function(Player)
    if STAFF_MEMBERS[Player.UserId] then
        StaffIcon.Visible = true
    end
end)

Okay so small problem, the localscript clones the frame named “Example” into the main frame and then renames “Example” to the Player’s name. How would I go about cloning it in the player’s frame?
image

Current full script?

local Teams = game:GetService("Teams")
local template = script.Example
local Players = game:GetService("Players")
local playere = game.Players.LocalPlayer
local playerList = script.Parent.ScrollingFrame

local STAFF_MEMBERS = {
	[1645028151] = true,
	[-1] = true
}
local StaffIcon =  script.Example.player.StaffIcon

	game:GetService("Players").PlayerAdded:Connect(function(Player)
		if STAFF_MEMBERS[Player.UserId] then
		StaffIcon.Visible = true
	end
	end)

function clearlist()
	for _,item in pairs(playerList:GetChildren()) do
		if item:IsA("TextLabel") then
			item:Destroy()
		end
	end
end

for _, team in ipairs(Teams:GetTeams()) do
	local frame = template:Clone()
	frame.Name = team.Name
	frame.LayoutOrder = #playerList:GetChildren()
end

function FillList()
	for _,player in ipairs(Players:GetChildren()) do
		if not playerList:FindFirstChild(player.Name) then
			local frame = template:Clone()
			frame.Name = player.Name
			frame.player.Text = player.Name
			frame.Parent = playerList

			frame.LayoutOrder = playerList[player.Team.Name].LayoutOrder + 1
			for _, object in pairs(playerList:GetChildren()) do 
				if object:IsA("Frame") and object.LayoutOrder >= frame.LayoutOrder and object ~= frame then

				end
			end
			player:GetPropertyChangedSignal("TeamColor"):Connect(function()
				frame.LayoutOrder = playerList[player.Team.Name].LayoutOrder + 1 
			end)
		end
	end
end


local function update()
	for i, team in pairs(Teams:GetTeams()) do
		if #team:GetPlayers() == 0 then
			print(string.format("There are no players on the %s team.",team.Name))
			playerList[team.Name].Visible = false
		elseif #team:GetPlayers() > 0 then
			print(string.format("There are players on the %s team.",team.Name))
			playerList[team.Name].Visible = true

		end
	end
end
update()

FillList()
game.Players.PlayerAdded:Connect(FillList)
game.Players.PlayerRemoving:Connect(function(player)
	if playerList:FindFirstChild(player.Name) then
		playerList:FindFirstChild(player.Name):Destroy()
	end
end)


for i, team in pairs(Teams:GetTeams()) do
	team.PlayerAdded:Connect(update)
	team.PlayerRemoved:Connect(update)
end

playerName = game.Players.LocalPlayer.Name

game.Players[playerName]

So like this?

local StaffIcon =  script.Parent.ScrollingFrame.playerName

Apologies, could you explain again what you want the script to do for staff members? I didn’t quite understand, also, make sure to be precise about every little detail.

So, for NON Staff members, I want their playerlist name to display normally.
image
But, to differentiate between normal players and Staff Members, I want the staff’s playerlist name to display with a sheild next to it like this, or any icon.
image

Where is the staff icon located?

Since it is located inside the player text lablel , the position is 0,0, 0,0
image

All players have the staff icon inside them, correct? Just invisible.

Correct

sadasdsadsadsadadasdasdas

			local frame = template:Clone()
			frame.Name = player.Name
			frame.player.Text = player.Name
			frame.Parent = playerList
            if STAFF_MEMBERS[Player.UserId] then
                frame.player.Stafficon.Visible = true
            end

Oh, I mean to parent it to the player.

local frame = template:Clone()
frame.Parent = game.Players[playerName].PlayerGui.ScreenGui.ScrollingFrame

I think that would work.

You can also completely get rid of this.

1 Like

Pretty sure that’s not at all what they want, but ok.

Nevermind actually, I forgot the script was inside the gui already

1 Like

the part Player in Player.UserId is underlined in orange.