Why doesn't my leaderboard function correctly?
Here's the code it works for 1 player (assuming the topplr), but for some reason once I added the clean() function it just wont even display. I have 2 main problems, the leaderboard won't function correctly and it wont display at all when I want to clean it. It also doesn't want to update. There are no output errors, I checked and fixed them all.
02 | local board = workspace.Fencing.SurfaceGui |
03 | local list = board.plrslist |
04 | local plr = script.name |
09 | for _,v in pairs (list:GetChildren()) do |
10 | if v.Name = = "name" then |
18 | for _,v in pairs (game.Players:GetPlayers()) do |
19 | local plrr = plr:clone() |
20 | local ls = v:WaitForChild( "leaderstats" ) |
25 | plrr.wins.Text = ls.Wins.Value |
26 | plrr.spree.Text = ls.Spree.Value |
27 | plrr.rank.Text = "Starter" |
28 | plrr.Position = UDim 2. new( 0 , 0 , 1 , 0 ) |
29 | elseif topplr ~ = nil and topplr.leaderstats.Wins.Value > v.leaderstats.Wins.Value and topplr ~ = v then |
33 | plrr.wins.Text = ls.Wins.Value |
34 | plrr.spree.Text = ls.Spree.Value |
35 | plrr.rank.Text = "Starter" |
36 | plrr.Position = UDim 2. new( 0 , 0 ,posy, 0 ) |
37 | elseif topplr ~ = nil and v.leaderstats.Wins.Value > topplr.leaderstats.Wins.Value and topplr ~ = v then |
41 | plrr.wins.Text = ls.Wins.Value |
42 | plrr.spree.Text = ls.Spree.Value |
43 | plrr.rank.Text = "Starter" |
44 | plrr.Position = UDim 2. new( 0 , 0 , 1 , 0 ) |