So I have a custom player list in my game and I have it so that it puts an icon next to the friends name when they’re in the game the only problem is its putting it on the friends name and my name (not sure if it would put it for everyone in the game even if you aren’t friends with the person and I cant rlly test that but still) ill link the photo:
So my name is iclimbedwall and my friend is leahpufff but I want it to show the icon for leahpufff (the person I’m friends with) only, not both of us. How can I make that work? Here’s the script for the player list it has the friend part in it.local userinput = game:GetService("UserInputService")
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 dev_icon = script:WaitForChild("DevIcon");
local developerIds = {
1822194589,
505994310,
883317228,
};
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 = "GothamSemibold"
local Corner = Instance.new("UICorner", listed)
if table.find(developerIds, players:GetUserIdFromNameAsync(name)) then
dev_icon:Clone().Parent = listed
end
local localPlayer = players.LocalPlayer
local friend_icon = script:WaitForChild("FriendIcon")
for _, user in pairs(players:GetPlayers()) do
if localPlayer == user then continue end
local isFriends = user:IsFriendsWith(localPlayer.UserId)
if not isFriends then
continue
end
friend_icon:Clone().Parent = listed
end
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 = true
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)
while true do
wait(0.1)
reload()
end
--updates on player join/leave
players.PlayerAdded:Connect(reload)
players.PlayerRemoving:Connect(reload)
reload()
The friend icon part is below
local localPlayer = players.LocalPlayer
local friend_icon = script:WaitForChild("FriendIcon")
for _, user in pairs(players:GetPlayers()) do
if localPlayer == user then continue end
local isFriends = user:IsFriendsWith(localPlayer.UserId)
if not isFriends then
continue
end
friend_icon:Clone().Parent = listed
end
The friend icon is parented to this script too and there is a template for the label (listed); ill show my explorer anyway
ListPlayers is the player list and the template is the text label that shows your name
[quote=“iclimbedwall, post:1, topic:1250330, full:true”]
So I have a custom player list in my game and I have it so that it puts an icon next to the friends name when they’re in the game the only problem is its putting it on the friends name and my name (not sure if it would put it for everyone in the game even if you aren’t friends with the person and I cant rlly test that but still) ill link the photo:
local userinput = game:GetService("UserInputService")
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 dev_icon = script:WaitForChild("DevIcon");
local developerIds = {
1822194589,
505994310,
883317228,
};
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 = "GothamSemibold"
local Corner = Instance.new("UICorner", listed)
if table.find(developerIds, players:GetUserIdFromNameAsync(name)) then
dev_icon:Clone().Parent = listed
end
local localPlayer = players.LocalPlayer
local friend_icon = script:WaitForChild("FriendIcon")
for _, user in pairs(players:GetPlayers()) do
if localPlayer == user then continue end
local isFriends = user:IsFriendsWith(localPlayer.UserId)
if not isFriends then
continue
end
friend_icon:Clone().Parent = listed
end
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 = true
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)
while true do
wait(0.1)
reload()
end
--updates on player join/leave
players.PlayerAdded:Connect(reload)
players.PlayerRemoving:Connect(reload)
reload()
The friend icon part is below
local localPlayer = players.LocalPlayer
local friend_icon = script:WaitForChild("FriendIcon")
for _, user in pairs(players:GetPlayers()) do
if localPlayer == user then continue end
local isFriends = user:IsFriendsWith(localPlayer.UserId)
if not isFriends then
continue
end
friend_icon:Clone().Parent = listed
end
The friend icon is parented to this script too and there is a template for the label (listed); ill show my explorer anyway
ListPlayers is the player list and the template is the text label that shows your name
hopefully i get a response this time