Please help fix pointsgiver script

Hi everyone I have made these scripts for giving you points when you click on the part but for some reason it ain’t working. Can someone help me with this?

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

local leaderstats = Instance.new(“IntValue”)

leaderstats.Name = ‘leaderstats’

leaderstats.Value = 0

local Points = Instance.new(“IntValue”)

Points.Name = ‘Points’

Points.Value = 0

leaderstats.Parent = player

Points.Parent = leaderstats

end)

THE POINTGIVER PART"S SCRIPT

script.Parent.ClickDetector.MouseClick:Connect(function(player)
local PlayerPoints = player.leaderstats.Points
PlayerPoints.Value = PlayerPoints + 1
end)

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder", player)
	leaderstats.Name = "leaderstats"
	local points = Instance.new("IntValue", leaderstats)
	points.Name = "Points"
end)

script.Parent.MouseClick:Connect(function(player)
	player:WaitForChild("leaderstats"):WaitForChild("Points").Value += 1
end)
2 Likes

thanks a lot for helping me out!