local enabled = true
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil and enabled == true then
local enabled = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local points = player.leaderstats.Points
points.Value = points.Value + 5
wait(3)
enabled = true
end
end)
So recently I'm learning how to code and I stumbled upon an error while coding a touched function. I tried debugging the error, but couldn't simply fix it. So I basically want to give my player five points each time the player touches an object. However, the script keeps on giving me way more than five points per touch. I added a de-bounce, but the error still occurs. Is there a way I can fix this?

2 comments
please make this easier to read
on line 12 try adding script.Parent.Touched:Disconnect()