Leaderstats problem

Hi Guys, I have a problem with my leaderstats. I’m trying to create a folder inside of my player called leaderstats with all of the intvalues but it isin’t working it seems, here is the code:

game.Players.PlayerAdded:Connect(function()

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

local Coins = Instance.new("IntValue")
Coins.Value = 0
Coins.Name = "Coins"

local prestige = Instance.new("IntValue")
prestige.Value = 0
prestige.Name = "Prestige"

end)

One problem that I identified is that there is a orange line under player in the script meaning that I haven’t referenced it but I thought you didn’t need to reference the player.

when you create the folder and set the name it should look like this: "leaderstats" not like this leaderstats
better change the code like this:

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

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

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

local prestige = Instance.new("IntValue")
prestige.Value = 0
prestige.Name = "Prestige"
prestige.Parent = leaderstats
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.