Leader board script not working

hello, so I recently wanted to make a sword fight game but the leader board was not working.
I watched a Video to learn but it didn’t work.
here is the script and feedback is appreciated. Thanks!

game.Players.PlayerAdded:Connect(function(player)

local leaderstats = Instance.new("Folder")
leaderstats.Name = "Leaderstats"
leaderstats.Parent = player

local coins = Instance.new("IntValue")
coins.Name = "coins"
coins.Value = 0
coins.Parent = leaderstats

end)
game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	local coins = Instance.new("IntValue")
	coins.Name = "Coins"
	coins.Value = 0
	coins.Parent = leaderstats
end)

“leaderstats” is case sensitive, it must start with a lowercase.

1 Like

thanks, that worked really well!