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

How to make a Leaderboard work by scripting?

Asked by 1 year ago

function update() c = script.Parent:GetChildren() for i = 1,#c do if string.sub(c[i].Name, 1, 11) == "PlayerLabel" then c[i].Visible = false end end for i = 1,#plr do item = script.Parent:findFirstChild("PlayerLabel" .. tostring(i)) if (item~=nil) then item.Visible = true item.Text = plr[i].Name end end end

function getNumber(obj) for i = 1,#plr do if plr[i]==obj then return i end end end

plr = {} p = game.Players:GetChildren()

for i = 1,#p do table.insert(plr, p[i]) end

update() game.Players.ChildAdded:connect(function (guy) table.insert(plr, guy) update() end) game.Players.ChildRemoved:connect(function (guy) table.remove(plr, getNumber(guy)) update() end)

0
Since my script won't work DisasterHotelGiant2 -246 — 1y

Answer this question