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

Any Help? Leaderboard Error [SOLVED]

Hi, I'm relatively new to ROBLOX coding, and I was making a simple Leaderboard which includes "Money" as a stat. I don't know what's wrong with my design, as it is the same as in the ROBLOX Wiki, but in a less compact way, so I understand it better

function CreateStats(Player)

	local Stats = Instance.new("IntValue")
	Stats.Parent = Player
	Stats.Name = "Leaderstats"

	local Cash = Instance.new("IntValue")
	Cash.Parent = Stats
	Cash.Name = "Cash"
	Cash.Value = 0

end

game.Players.ChildAdded:connect(CreateStats)

When I test the game the leaderboard doesn't show up, but I don't know why. I would thank if someone could help me.

- mranderson11

2 answers

✓ Accepted answer

This should work. You start off with 0 anyways, so there's no reason to include it. Hopefully this helps! :)

game.Players.PlayerAdded:connect(function(player)
	local ls = Instance.new("IntValue",player)
	ls.Name = "leaderstats"
	local points = Instance.new("IntValue",ls)
	points.Name = "Cash"
end)

Make sure you accept an answer, so we don't have to come back to answered questions.

Mistake1 there is supposed to be model inside player first then make intvalue inside model.



game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
Instance.new("IntValue", leaderstats).Name = "Cash"

end)

If this helped +1

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