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

My Leaderboard script isn't working no matter what?

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

✓ Accepted answer

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)

1 comment

0

+1 point for you

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