How to make a custom kill sound (solved)

How would I create a kill sound system similar to Zo? You input a code into some ui then when you get a kill it plays that sound within a certain radius? They also have a setting to turn off everyone else’s kill sounds. How would I achieve that?

Any suggestions or tips would be extremely helpful!

The first step is to make sure you have a way to detect whether you kill the enemy.
The most basic way I can think of looks something like this:

-- This function will deal damage to a humanoid, and return true if it kills them
function damage(humanoid, amount)
   local health = humanoid.Health
   humanoid:TakeDamage(amount)
   if health > 0 and humanoid.Health <= 0 then
      return true
   end
   return false
end

if damage(human, 50) then -- Deal 50 damage. If it kills the humanoid, play the sound
   sound:Play()
end
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.