Debounce for rewarding player

Hello, and I made a custom gun in my game, and I’m rewarding the player for killing someone. And It’s supposed to reward 15 Points, and not more than 15 Points from one kill. Where could I put the debounce in the script?

Here is my script:

script.Parent.DealDamage.OnServerEvent:Connect(function(player, Target, Damage)
	Target.Humanoid:TakeDamage(Damage)
	if Target.Humanoid.Health <= 0 then
		player.leaderstats.Points.Value = player.leaderstats.Points.Value + 15
		player.leaderstats.Kills.Value = player.leaderstats.Kills.Value + 1
	end
end)
local db = false
script.Parent.DealDamage.OnServerEvent:Connect(function(player, Target, Damage)
	Target.Humanoid:TakeDamage(Damage)
	if Target.Humanoid.Health <= 0 then
       if db == false then
        db= true
		player.leaderstats.Points.Value = player.leaderstats.Points.Value + 15
		player.leaderstats.Kills.Value = player.leaderstats.Kills.Value + 1
        task.wait(3)
        db = false
        end
	end
end)
1 Like

It now works! Thank you so much!

1 Like