What does this error mean?

I was trying to create a leaderboard in the top right hand corner of my game and I got this error and I don’t know what it means.
This is the error

ServerScriptService.Leaderstats:3: invalid argument #3 (string expected, got Instance)

This is the code

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new (“Folder”)
leaderstats.Name = leaderstats
leaderstats.Parent = player

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

end)

And the name of the script is called Leaderstats.

You’re setting the property Name to an instance, I assume you want:

leaderstats.Name = "leaderstats"
1 Like