Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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:

game.Players.PlayerAdded:connect(function(player)
	local leaderstats = Instance.new("Model")
	leaderstats.Name = "Points"
	leaderstats.Parent = player
	
	local coin = Instance.new("IntValue")
	coin.Value = 0
	coin.Name = "Coins Collected"
	coin.Parent = leaderstats
end)

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:

game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model")
     leaderstats.Name = "leaderstats"
     leaderstats.Parent = player
 
     local money = Instance.new("IntValue")
     money.Name = "Money" 
     money.Value = 0 
     money.Parent = leaderstats
 end)

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

1 comment

0

Ahh ok, the reason why is because when naming the 'leaderstats' variable, it HAS to have the name of 'leaderstats'.

1 answer

✓ Accepted answer

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.

game.Players.PlayerAdded:connect(function(player)
    local leaderstats = Instance.new("Model")
    leaderstats.Parent = player --I parented here
    leaderstats.Name = "leaderstats" --Here, you HAVE to name it leaderstats, not too sure why but you HAVE too ;PP

    local coin = Instance.new("IntValue")
    coin.Parent = leaderstats --I parented here
    coin.Value = 0
    coin.Name = "Coins Collected"
end)

Hope this helped.

4 comments

0

I tried parenting it first, but that didn't work.

0

I edited my script, this should work. I made a new comment on line 4.

0

Ok, thanks that worked.

0

Np

This discussion is preserved as it was. New answers, comments, and votes are closed.