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

Why is there no leader board appearing in studio and in server?[EDIT]

Asked by
Peeshavee 226 Moderation Voter
8 years ago
Edited 8 years ago

So, I'm currently learning about Leader boards. I've read so far the whole wiki page, but now that I did what their script says, nothing appears. Here's the script:

01game.Players.PlayerAdded:connect(function(player)
02    local leaderstats = Instance.new("Model")
03    leaderstats.Name = "Points"
04    leaderstats.Parent = player
05 
06    local coin = Instance.new("IntValue")
07    coin.Value = 0
08    coin.Name = "Coins Collected"
09    coin.Parent = leaderstats
10end)

Any ideas as to why nothing is appearing? All help is appreciated!

[EDIT PART]

So I've noticed that ROBLOX's script work's fine:

01game.Players.PlayerAdded:connect(function(player)
02     local leaderstats = Instance.new("Model")
03     leaderstats.Name = "leaderstats"
04     leaderstats.Parent = player
05 
06     local money = Instance.new("IntValue")
07     money.Name = "Money"
08     money.Value = 0
09     money.Parent = leaderstats
10 end)

What's the difference between my script, and theirs?

0
Ahh ok, the reason why is because when naming the 'leaderstats' variable, it HAS to have the name of 'leaderstats'. FiredDusk 1466 — 8y

1 answer

Log in to vote
1
Answered by
FiredDusk 1466 Moderation Voter
8 years ago
Edited 8 years ago

First off, make sure the script is not disabled. Also, I would make sure you parent the 'Model' and 'CoinValue' to where it needs to be before you name it and change the values of it.

01game.Players.PlayerAdded:connect(function(player)
02    local leaderstats = Instance.new("Model")
03    leaderstats.Parent = player --I parented here
04    leaderstats.Name = "leaderstats" --Here, you HAVE to name it leaderstats, not too sure why but you HAVE too ;PP
05 
06    local coin = Instance.new("IntValue")
07    coin.Parent = leaderstats --I parented here
08    coin.Value = 0
09    coin.Name = "Coins Collected"
10end)

Hope this helped.

0
I tried parenting it first, but that didn't work. Peeshavee 226 — 8y
0
I edited my script, this should work. I made a new comment on line 4. FiredDusk 1466 — 8y
0
Ok, thanks that worked. Peeshavee 226 — 8y
0
Np FiredDusk 1466 — 8y
Ad

Answer this question