I have tried 2 scripts to make it so when you touch a part, it givers you points. I already have leaderstats, and here it is. Tell me if the leaderstats is correct.
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Points = Instance.new("IntValue", leaderstats)
Points.Name = "Points"
end)
That is my leaderstats. Now the script that I put in the part, is this.
script.Parent.Touched:Connect(function(player)
local PlayerPoints = game.Players.LocalPlayer.leaderstats.Points
PlayerPoints.Value = PlayerPoints.Value + 1
end)
This is the error I got when I touched the part.
leaderstats is not a valid member of MeshPart "Workspace.MyUsername.LeftFoot"
Please help me. Thank you!
