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

Why is this custom GUI-based leaderboard script not working?

Asked by 7 years ago

This script is supposed to print the names of current players in a game in TextLabels in a GUI in each player. However, the script is not doing anything, and output did not give me anything.

Can someone please help me?

Here's the script:

local playerCount = {}

game.Players.PlayerAdded:connect(function(player)
    local frameChildren = script.Parent.Frame:GetChildren()
    for i = 1, #frameChildren do
        frameChildren[i].Text = " "
    end
    wait()
    table.insert(playerCount, player.Name)
    wait()
    updateUI()
end)

game.Players.PlayerRemoving:connect(function(player)
    local frameChildren = script.Parent.Frame:GetChildren()
    for i = 1, #frameChildren do
        frameChildren[i].Text = " "
    end
    wait()
    table.remove(playerCount, player)
    wait()
    updateUI()
end)

function updateUI()
    for i = 1, #playerCount do
        script.Parent.Frame['Label'..i].Text = ""..playerCount[i]
    end
end
0
can you test how far your script runs, this can be done by addeing prints ofter each line e.g. print('a'), print('b') ect User#5423 17 — 7y
0
I did, and nothing printed. CoolJohnnyboy 121 — 7y

Answer this question