This is part of a script that is responsible for damaging the opponents health as well as reward the player with 10 FCash, 1 Spree and 1 Counter. It kills the opponent but doesn't give me cash. Why?
local HitPlayers = {}
local LeftButtonDownTime = nil
local Attacking = false
function Blow(hit)
if Attacking then
BlowDamage(hit, Damage)
end
end
function BlowDamage(hit, damage)
local humanoid = hit.Parent:FindFirstChild('Humanoid')
--local player = PlayersService:GetPlayerFromCharacter(hit.Parent)
if humanoid ~= nil and MyHumanoid ~= nil and humanoid ~= MyHumanoid then
-- final check, make sure weapon is in-hand
local rightArm = MyCharacter:FindFirstChild('Right Arm')
if (rightArm ~= nil) then
-- Check if the weld exists between the hand and the weapon
local joint = rightArm:FindFirstChild('RightGrip')
if (joint ~= nil and (joint.Part0 == Handle or joint.Part1 == Handle)) then
-- Make sure you only hit them once per swing
if not HitPlayers[hit.Parent] and humanoid.Health>0 and MyHumanoid.Health>0 then
TagHumanoid(humanoid, MyPlayer)
print("Sending " .. damage)
humanoid.Health=humanoid.Health-damage
Handle.Splat.Volume = 1
HitPlayers[hit.Parent] = true
if humanoid.Health < 0 and MyHumanoid.Health>0 then
local leaderstats = MyPlayer.leaderstats
local Counter = MyPlayer.Counter
local Spree = leaderstats.Spree
Counter.Value = Counter.Value +1
Spree.Value = Spree.Value +1
leaderstats.FCash.Value = leaderstats.FCash.Value +10
HitPlayers[hit.Parent] = false
wait(10)
end
end
end
end
end
end

2 comments
Problem with that is, If I hit the dead player again after he dies, i am rewarded twice which I don't want
use a debounce then?