How to get an icon to display next to a player's username if they're a developer (by using their UserId)

So I have a custom playerlist and I want a hammer icon to show up next to their name on the list
(like this) Screen Shot 2021-05-03 at 8.14.32 PM
The template is for the player’s username which gets cloned when they join and the devicon is also parented to the script and I want it to parent to the player that is the developer’s template
Screen Shot 2021-05-03 at 8.13.30 PM
Here’s the script for the player list (I didn’t start the developer icon part in the script yet that’s what I need help with)

local startergui = game:GetService("StarterGui")
local players = game:GetService("Players")
local listframe = script.Parent
local playerlist = listframe.ListPlayers

--default list disable, remove if you're already doing this
repeat
	local load = pcall(function()
		startergui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
	end)
	wait(0.2)
until load

local function makebox(name, current)
	local listed = script.Template:Clone()
	listed.Parent = script.Parent.ListPlayers
	listed.Position = UDim2.new(0.032,0,0.013,current*60)
	listed.Name = name
	listed.Text = name

	--you can use your own values here
	listed.BackgroundColor3 = script.Parent.ListTitle.BackgroundColor3
	listed.TextStrokeColor3 = script.Parent.ListTitle.TextStrokeColor3
	listed.TextStrokeTransparency = 0
	listed.Size = UDim2.new(0.929, 0, 0.072, 0)
	listed.TextScaled = true
	listed.TextColor3 = Color3.new(1, 1, 1)
	listed.Font = "Cartoon"
	local Corner = Instance.new("UICorner", listed)
end

local function reload() --this reloads the player list when called
	for _,v in pairs(playerlist:GetChildren()) do
		v:Destroy()
	end
	for _,v in pairs(players:GetChildren()) do
		makebox(v.Name, #playerlist:GetChildren())
	end
end

local isActive = false
userinput.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Tab then --will show/hide with tab
		if not isActive then
			reload() --updates on tab press
			isActive = true
			listframe.Visible = true
		else
			isActive = false
			listframe.Visible = false
		end
	end
end)

--updates on player join/leave
players.PlayerAdded:Connect(reload)
players.PlayerRemoving:Connect(reload)

reload()
1 Like

I’m not sure if this is possible, however there are some alternatives that I’ve seen used with custom leaderboards.

  • Listing your game developers in a table.
  • If your game is a group game you can whitelist rank Id’s that have access to editing your game.
1 Like

Ok so if like a group member is a certain role in my group how would I make it show that only next to their name and not everyone else’s

Your system looks a little complex, but I have one that may help you.
image

Script:
local groupID = IDGROUP

game.Workspace.ChildAdded:Connect(function(child)

if game.Players:FindFirstChild(child.Name) then

local player = game.Players:FindFirstChild(child.Name)

script.Rank.Enabled = true

local groupRank = player:GetRoleInGroup(groupID)

if groupRank == “Member” then

script.Rank.Enabled = false

end

if groupRank == “Guest” then

script.Rank.Enabled = false

end

local clone = script.Rank:Clone()

clone.Parent = child:WaitForChild(“Head”)

clone.Frame.RankLabel.Text = groupRank

end

end)

this will allow you a creator tag name

1 Like

oh yea I can try that but thats like a tag above your head and I’m trying to see if theres a way for me to get it in the player list

I can help you.
First, put this in your code (make sure to put it before the local function makebox(name, current) line):

local dev_icon = script:WaitForChild("DevIcon");
local developerIds = {
	1822194589,
};

Then, place the player IDs of all the developers of your game inside of the developerIds table (I already put your player ID in there just so you know how it works).
After that, put this in the end of the makebox function:

if table.find(developerIds, players:GetUserIdFromNameAsync(name)) then
	dev_icon:Clone().Parent = listed
end

I hope this works for you, tell me if you have any issues.

I decided to shorten the code a lot to make it simpler.

2 Likes

Don’t use a for loop if you don’t need to, simply replace the whole loop with if table.find(developerIds,find_player_id) then return true end

2 Likes

how did i never know that exists

thanks btw

Ok thanks ill try this later or tmrw and ill let yk if it works

Sorry to bump this post, but why not just do this?: if player.UserId == game.CreatorId then