So as i had previously asked, my code won't give me one kill per kill. I get more then one kill. So I added a debouce system. Now, instead of getting any points, i get none. Why does that happen? Here is my script.
ball = script.Parent
damage = 50
local debounce = true
function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid~=nil then
tagHumanoid(humanoid)
humanoid.Health = humanoid.Health - damage
if debounce then
debounce = false
if humanoid.Health == 0 or humanoid.Health < 0 then
local z = game.Players:FindFirstChild(game.ReplicatedStorage.asd.Value)
z.leaderstats.Kills.Value += 1
wait(2)
debounce = true
end
end
untagHumanoid(humanoid)
connection:disconnect()
else
damage = damage / 2
if damage < 2 then
connection:disconnect()
ball.Parent = nil
end
end

1 comment
I used this tutorial https://www.mrmichaelsclass.com/roblox-studio/scripting-examples/touch-for-points