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

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

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)

1 comment

0

why are you using a folder?

3 answers

✓ Accepted answer
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)

4 comments

0

Why are you using ChildAdded?

1

so it makes the leader value when they join

0

Any way you can make it to where it shows after the intro screen is over?

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.

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)

2 comments

0

I used your addition but that did not help!

0

Yes it did.

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)

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