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

My Leaderboard script isn't working no matter what?

Asked by
Vid_eo 126
9 years ago

I'm trying to make an FPS game, but my leaderboard (For money) never shows for no reason! Here is the code:

game.Players.PlayerAdded:connect(function(p)
    local stats = Instance.new("IntValue")
    stats.Name = ("leaderstats")

    local money = Instance.new("IntValue")
    money.Name = "Money" 
    money.Value = 50
    money.Parent = stats
end)

Thank you in advance :)

1 answer

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

Well, you forgot to parent stats in p.

There's a second parameter that parents the new instance.

game.Players.PlayerAdded:connect(function(p)
    local stats = Instance.new("IntValue", p)
    stats.Name = ("leaderstats")

    local money = Instance.new("IntValue", stats)
    money.Name = "Money" 
    money.Value = 50
end)
0
+1 point for you XToonLinkX123 580 — 9y
Ad

Answer this question