With my custom player list for my roleplay game, I would like to have game staff has a little mod tag, and when you click on them, a player details frame shows, saying what rank they are. With the way I made my script, it only shows one player, but the header says 2, I was testing this with a friend, and I couldn’t see my profile tag on the list, only his, but if I am in the server alone, then I can see my profile tag. Please help me!
My Script:
game:GetService(“StarterGui”):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
local v1 = script.Parent.Main
v1.NoSelection.Visible = true
v1.Details.Visible = false
local u2 = require(script.Parent.Parent.Parent.MenuFunctions2)
local Main = script.Parent.Main
local listItem = script.ListItem:Clone()
local function updatePlayerList()
local playerCount = #game.Players:GetPlayers()
Main.List.Header.Players.Text = “Players (” … playerCount … “)”
u2.AddMenuConnection(Main, Main.List.Header.SearchFrame.Clear.MouseButton1Down:Connect(function()
Main.List.Header.SearchFrame.TypeBox.Text = ""
for _, v in pairs(Main.List.ScrollingFrame:GetChildren()) do
if v:IsA("TextButton") then
v.Visible = true
end
end
Main.List.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, Main.List.ScrollingFrame.UIListLayout.AbsoluteContentSize.Y)
Main.List.Header.SearchFrame.Clear.Visible = false
end))
u2.AddMenuConnection(Main, Main.List.Header.SearchFrame.Clear.MouseEnter:Connect(function()
Main.List.Header.SearchFrame.Clear.ImageColor3 = Color3.fromRGB(158, 0, 0)
end))
u2.AddMenuConnection(Main, Main.List.Header.SearchFrame.Clear.MouseLeave:Connect(function()
Main.List.Header.SearchFrame.Clear.ImageColor3 = Color3.fromRGB(229, 0, 0)
end))
u2.AddMenuConnection(Main, Main.List.Header.SearchFrame.TypeBox.Changed:Connect(function()
local searchQuery = Main.List.Header.SearchFrame.TypeBox.Text:lower()
Main.List.Header.SearchFrame.Clear.Visible = searchQuery ~= ""
for _, v in pairs(Main.List.ScrollingFrame:GetChildren()) do
if v:IsA("TextButton") then
local username = v.Username.Text:lower()
local displayName = v.DisplayName.Text:lower()
v.Visible = searchQuery == "" or username:match(searchQuery) or displayName:match(searchQuery)
end
end
end))
for _, v in pairs(game.Players:GetPlayers()) do
if v:IsDescendantOf(game.Players) then
local playerLayout = Main.List.ScrollingFrame:FindFirstChild(v.Name)
if playerLayout then
playerLayout:Destroy()
end
listItem.Username.Text = "@" .. v.Name
listItem.DisplayName.Text = v.DisplayName
listItem.TeamName.Text = v.Team and v.Team.Name or "No Team"
listItem.Avatar.Image = "rbxthumb://type=AvatarHeadShot&id=" .. tostring(v.UserId) .. "&w=180&h=180"
if v:FindFirstChild("Device") then
listItem.Device.Image = v.Device.Value == "Tablet" and "http://www.roblox.com/asset/?id=5606203139" or "http://www.roblox.com/asset/?id=5606203135"
else
listItem.Device.Image = "http://www.roblox.com/asset/?id=5606203135"
end
spawn(function()
if v:GetRankInGroup(7683625) >= 120 and listItem and listItem.Parent then
listItem:WaitForChild("ModIcon").Visible = true
listItem:WaitForChild("Username").Position = UDim2.new(0, 95, 0.52, 0)
listItem:WaitForChild("DisplayName").Position = UDim2.new(0, 97, 0.05, 0)
end
end)
listItem.MouseButton1Down:Connect(function()
Main.NoSelection.Visible = false
Main.Details.Visible = true
Main.Details.Profile.Avatar.Image = "rbxthumb://type=AvatarBust&id=" .. tostring(v.UserId) .. "&w=180&h=180"
Main.Details.Profile.Username.Text = "@" .. v.Name
Main.Details.Profile.DisplayName.Text = v.DisplayName
Main.Details.Profile.StatusDetails.GameMod.Text = "OFFICIAL TCRP GAME MODERATOR"
Main.Details.Profile.StatusDetails.GameMod.Visible = listItem.ModIcon.Visible
end)
if v:GetRankInGroup(7683625) >= 253 then
Main.Details.Profile.StatusDetails.GameMod.Text = "TCRP " .. v:GetRoleInGroup(7683625)
end
listItem.Parent = Main.List.ScrollingFrame
end
end
end
game.Players.PlayerRemoving:Connect(function(plr)
local playerLayout = Main.List.ScrollingFrame:FindFirstChild(plr.Name)
if playerLayout then
playerLayout:Destroy()
end
end)
while true do
wait()
updatePlayerList()
end