So I’m relatively new to scripting code, and so I followed a tutorial for the most part to help me make a custom player list.
However the problem with this is that the player list disappears when one of the players leaves and will only come back if the player dies.
Here’s the script I used,
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
local function Tem(player)
local frame = game.ReplicatedStorage.Template:Clone()
frame.Parent = script.Parent.Frame.ScrollingFrame
frame.Name = player.Name
frame.name.Text = player.Name
frame.Visible = true
end
game.Players.PlayerAdded:Connect(function(plr)
Tem(plr)
end)
for _, players in pairs(game.Players:GetChildren()) do
Tem(players)
end
game.Players.PlayerRemoving:Connect(function(plr)
for i,v in pairs(script.Parent.Frame.ScrollingFrame:GetChildren()) do
if v.Name and plr.Name then
v:remove()
end
end
end)
and the layout of the items,
I think for the error lies in the PlayerRemoving section, whereas the script detects a player leaving, and when deleting the name, it ends up deleting all player names on the playerlist, I did try basic things like switch around the order, for the v.Name and plr.Name part, but I honestly have no idea what to do. I tried looking around on DeveloperHub to the best I could, but I couldn’t find any solutions.