Hihi! I am DeltaVar and I am trying to make a FPS game. However, I am currently struggling in making a leaderboard that shows your teammate. Like when you open a GUI, it would show every teammate in your team with their Name and Profile picture. Is there anyway I can do this?
It’s not really difficult. Use a frame and put a ListLayout in it then create a template frame with an ImageLabel for the profile picture and a label for the username then once the round starts loop through the players in the team, clone the template and put it into the main frame. To get the user profile picture use Players:GetUserThumbnailAsync()
How can I do so? Mind if u could type a small sample code?
local player = game.Players.LocalPlayer
local MainFrame = player:WaitForChild("PlayerGui"):FindFirstChild("PlayersList").MainFrame
local template = script:WaitForChild("Template")
RoundStartTrigger:Connect(funxtion()
for i, plr in pairs(game.Players:GetPlayers()) do
-- Get player thumbnail: dev hub link below
local newTemplate = template:Clone()
newTemplate.ImageLabel.Image = thumbnail
newTemplate.PlayerName = plr.Name
newTemplate.Name = plr.Name
newTemplate.Parent = mainFrame
end
end)
https://developer.roblox.com/en-us/api-reference/function/Players/GetUserThumbnailAsync
Ah thanks mate! I will test it out now
Uh, how do I make it so its only saying the people in my team?
Well loop through all the teams and then loop through all the members
Is it possible if I could like, make the order of the templates in the order of who has the most money to the least money?
Set the ListLayout order to “name” or alphabetical order or something like that and then put the money amount at the start of the template’s name