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

Help with a Custom Leaderboard Gui?

Asked by 10 years ago

Hey, guys. I was trying to make a Custom Leaderboard Gui, but I got stuck because it wouldn't work right. The Gui is in this form: StarterGui > ScreenGui > Frame > Script. There is also a TextLabel inside ServerStorage. What my script was suppose to do was clone the TextLabel from ServerStorage into the Frame, as much times as there are the number of players, and make the text for all those TextLabels, all the players in the games' names.

local Player = script.Parent.Parent.Parent.Parent
local x = script.Parent
Template = game.ServerStorage.LeaderboardTemplate:clone()
Players = game.Players:GetChildren()
num = 35
playas = 0
while true do
    for i = 1, #Players do
        print(#Players)
        if playas < 8 then
            playas = playas +1
            T2 = Template:clone()
            T2.Parent = x
            T2.Position = T2.Positoin + UDim2.new(0, 0, 0, num)
            T2.Name = "PlayerButton"
            T2.Text = Players[i].Name
        end
    end
end

If anyone could explain to me what I did wrong, it would be very helpful!

0
Local scripts can't "see" inside server storage. Instead, you should use replicated storage. Also, game.Players.LocalPlayer is an easier way to get the player in local scripts. GoldenPhysics 474 — 10y
0
Thank you for the replicated storage tip! dpark19285 375 — 10y

1 answer

Log in to vote
-2
Answered by 10 years ago

Please remove the "#" from the word "Player" so it will work, you called it "Player" not "#Player".

0
He did #Players as in the number of values in the "Players" table. That's how lots of generic for loops that change all the players in the game work. OniiCh_n 410 — 10y
Ad

Answer this question