Game owner icon does not show up in custom playerlist

Hey so I am currently making a custom playerlist, it looks exactly like the current roblox 2020 one, and actually its basically me just ripping out playerlist UI and coding it myself so I can add custom players and icons, so far it currently works except when the game owner joins the game it does not show the owner icon.

Code

local ContextActionService = game:GetService("ContextActionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ScrollingFrame = script:WaitForChild("ScrollingFrameContainer")
local Event = ReplicatedStorage:WaitForChild("Z")
local LocalPlayer = game.Players.LocalPlayer
local Frame = script.Parent.PlayerListMaster
local visible = false
local cooldown = false
local icons = {

Friend = "http://www.roblox.com/asset/?id=4956543949";
Premium = "http://www.roblox.com/asset/?id=4956555935";
Owner = "http://www.roblox.com/asset/?id=4956556516";

}

function toggle()
	if visible == false and cooldown == false then
		cooldown = true
		Frame:TweenPosition(UDim2.new(1.26, -4, 0, 4), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2)
		visible = true
		wait(0.2)
		cooldown = false
	elseif cooldown == false then
		cooldown = true
		Frame:TweenPosition(UDim2.new(1,-4,0,4), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2)
		visible = false
		wait(0.2)
		cooldown = false
	end
end

ContextActionService:BindAction("TogglePlayerlast", toggle, false, Enum.KeyCode.Tab)

function createnew(Player, skip)
	print(Player)
	print(skip)
	local found = false
	for i,v in pairs(script.Parent.PlayerListMaster.OffsetFrame.PlayerScrollList.SizeOffsetFrame:GetChildren()) do
		if v.Name == "ScrollingFrameContainer" then
			if skip == false then
				if v.Player.Value == Player.Name then
					print("found skip is false")
					found = true
				end
			else
				if v.Player.Value == Player then
					print("found skip is true")
					found = true
				end
			end
		end
	end
	
	if found == false then
		print("SKIP IS FALSE")
		local Clone = ScrollingFrame:Clone()
		local Name = Clone.ScrollingFrameClippingFrame.ScollingFrame.OffsetUndoFrame.p_130661594.ChildrenFrame.NameFrame.BGFrame.OverlayFrame.PlayerName.PlayerName
		local Icon = Clone.ScrollingFrameClippingFrame.ScollingFrame.OffsetUndoFrame.p_130661594.ChildrenFrame.NameFrame.BGFrame.OverlayFrame.PlayerIcon
		
		if skip == false then
			Name.Text = Player.Name
		else
			Name.Text = Player
		end
		
		pcall(function()
		if skip == false then
			if Player.MembershipType == Enum.MembershipType.Premium then
				Icon = icons.Premium
			end
		end
		
		if skip == false then
			if LocalPlayer:IsFriendsWith(Player.UserId) == true then
				Icon = icons.Friend
			end
		end
		
		if skip == false then
			if game.CreatorId == Player.UserId then
				Icon = icons.Owner
			end
		else
			if Player.Name == game.Players:GetNameFromUserIdAsync(game.CreatorId) then
				Icon = icons.Owner
			end
		end
		
		if skip == false then
			Clone.Player.Value = Player.Name
		else
			Clone.Player.Value = Player
		end
		end)
		
		Clone.Parent = script.Parent.PlayerListMaster.OffsetFrame.PlayerScrollList.SizeOffsetFrame
	end
end

function remove(Player, skip)
	for i,v in pairs(script.Parent.PlayerListMaster.OffsetFrame.PlayerScrollList.SizeOffsetFrame:GetChildren()) do
		if v.Name == "ScrollingFrameContainer" then
			if skip == false then
				if v.Player.Value == Player.Name then
					v:Destroy()
				end
			else
				if v.Player.Value == Player then
					v:Destroy()
				end	
			end
		end
	end
end

game.Players.PlayerAdded:Connect(function(Player)
	createnew(Player, false)
end)

game.Players.PlayerRemoving:Connect(function(Player)
	remove(Player, false)
end)

Event.OnClientEvent:Connect(function(PlayerName, Mode)
	print("mode is " .. Mode)
	if Mode == "join" then
		createnew(PlayerName, true)
	else
		remove(PlayerName, true)
	end
end)

createnew(LocalPlayer, false)
for i,v in pairs(game.Players:GetChildren()) do
	createnew(v, false)
end
1 Like

It might not be working because I took a look at your asset and it is just plain white. If this is not the case then it might be because you are not setting the Image as your Icon variable.

I will play test this code and check if it’s an error with how I set the icon but I’m about to go to bed and will wait for Tomorrow.

It appears its the way im setting the image as my icon variable as the problem, so I changed things like Icon = icons.Premium to Icon.Image = icons.Premium however it had no effect and threw no errors