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

I need help I am trying to display the the person leader board stats as a GUI can you help me?

Asked by 5 years ago

I have been trying to do this for a couple of hours but it wont work, Here is my leader board script so far.

game.Players.PlayerAdded:connect(function(plr)
    local stats = Instance.new('IntValue', plr)
    stats.Name = 'leaderstats'
    local cash = Instance.new('IntValue', stats)
    cash.Name = 'Cash'
    cash.Value = 0
    local c = game.StarterGui.Leaderboard.Frame.TextLabel
    wait()
    c.Text = "Cash: "..cash.Value

end)

I need it so it is the players stats that he/she is looking at I want it as a text label after Cash:

1 answer

Log in to vote
1
Answered by 5 years ago

Delete line 7,8 and 9 and make a local script in game.StarterGui.Leaderboard.Frame.TextLabel with this code:

local gui = script.Parent
local cash = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Cash")

while wait() do
    gui.Text = "Cash: "..cash.Value
end
Ad

Answer this question