Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Looping trough all players, custom leaderboard?

Asked by 4 years ago
Edited 4 years ago

Hey guys!

I'm trying to set up this really simple custom leaderboard that displays the rank and username of all players in-game. Everytime the leaderboard is opened it'll get the names, so it won't have to loop whilst open.

I have this code right now:

local plrs =game:GetService("Players")
local plr = plrs.LocalPlayer
local temp = script:WaitForChild("template")
local id = 1

for i,v in pairs (plrs:GetChildren()) do
    local display = temp:Clone()
    display.Parent = script.Parent.display.ScrollingFrame
    display.Name = v.Name
    display.name.Text = v.Name
    if v:IsInGroup(id) then
        display.rank.Text = v:GetRoleInGroup(id)
    else
        display.rank.Text = "Guest"
    end
    display.Position = UDim2.new(0,0,0,60 * (i - 1))
end

when running this, it only displays the username of the one opening the leaderboard. When I play with 3 test users, each user only sees their own name on the top. There are no cloned displays from other users. Anyone know why my template isn't cloning for ALL players in-game, rather than just one?

EDIT: The leaderboard isn't like the ones you have on your top right of the screen. It's an actual GUI which would function as a leaderboard. See below

https://gyazo.com/9e6a66293414afa5701e84d895c75727

1 answer

Log in to vote
-1
Answered by
WoTrox 345 Moderation Voter
4 years ago

The best way to know something, is to ask, or watch. The previous one is easier at the moment. Watch this YouTube video

0
Not a valid answer. He already has a custom leaderboard. DeceptiveCaster 3761 — 4y
0
Hi. I appreciate your response, and it might've been my fault for not properly explaining. My GUI ins't an actual leaderboard, it's just ment to look like one. https://gyazo.com/c127fbc13ca1ba30157ef3a3cabf7cbf This video sadly won't help me RegisteredCode 5 — 4y
Ad

Answer this question