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

How can I get my in game leaderboard to show up?

Asked by 5 years ago
Edited 5 years ago

It like "hides" itself or something.

game.Players.PlayerAdded:connect(function(player) local leaderstat = Instance.new("Folder",player) leaderstat.Name = "leaderstats" local money = Instance.new("IntValue",leaderstat) money.Name = "Cash" -- Currency name here money.Value = 500 -- Starting money end)

0
why are you using a folder? The_Pr0fessor 595 — 5y

3 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
function onPlayerEntered(newPlayer) 
wait(.5) 
local stats = Instance.new("IntValue") 
stats.Name = "leaderstats" 

local Cash = Instance.new("IntValue") 

Cash.Name = "Cash" 
Cash.Value = 0 --You can change this value into the amount a player starts with

Cash.Parent = stats 

while newPlayer.Character == nil do 
wait() 
end 

local Player = string.lower(newPlayer.Name) 


stats.Parent = newPlayer 

end 


game.Players.ChildAdded:connect(onPlayerEntered)
0
Why are you using ChildAdded? User#19524 175 — 5y
1
so it makes the leader value when they join The_Pr0fessor 595 — 5y
0
Any way you can make it to where it shows after the intro screen is over? BitConDude 2 — 5y
0
If you use ChildAdded there is no guarantee that the child added will be a Player object, thus erroring since the Player class is the only class with a Character property. User#19524 175 — 5y
Ad
Log in to vote
1
Answered by
Griffi0n 315 Moderation Voter
5 years ago
Edited 5 years ago
game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    local money = Instance.new("IntValue")
    money.Name = "Cash"
    money.Value = 500
    money.Parent = leaderstats
    leaderstats.Parent = player
end)
0
I used your addition but that did not help! BitConDude 2 — 5y
0
Yes it did. Griffi0n 315 — 5y
Log in to vote
0
Answered by
zblox164 531 Moderation Voter
5 years ago
Edited 5 years ago
game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("IntValue", player)
    leaderstats.Name = "leaderstats"

    local Money = Instance.new("IntValue", leaderstats)
    Money.Name = "Money"    
    Money.Value = 100 -- Starter Cash
end)

Answer this question