I have made a leaderboard, but I don't know how to increase it. I want to make it so when you collide with a part, it destroys the part and gives you the value this is my code so far: script in serverscriptservice
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 0
gold.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
script inside of part:
script.parent.Touched:connect(function(Player)
script.parent:destroy()
Player.leaderstats.Gold.Value = Player.leaderstats.Gold.Value + 1
end)
when I run it, it says leaderstats is not a valid member of Part What do I do?

6 comments
put the link into ().
remove is deprecated, destroy is not. :Destroy() is the correct usage.
Thank you!
@blockmask, you have a typo on line 3, it should be script.Parent, not script.parent
Oh, right
Fixed, thank you guys