Can't get debounce to work for kill effect with classic sword

Hello, I’m trying to add a kill effect to the classic sword, so when you kill someone with the sword, it temporarily creates some ParticleEmitter effect inside of them.

When I kill someone with the sword, it inserts the ParticleEmitter effect in their character (head), however it adds multiple ParticleEmitters instead of one.

Here is the code:

I have tried adding a debounce to the code so it only inserts one ParticleEmitter, but it continues to insert multiple ParticleEmitters after a kill with the sword:

If someone could assist me with the debounce part, or provide a more optimal way to achieve this kill effect, it would be greatly appreciated.

Thats not really how Debounces work,

Place db outside that block of code and cover the entire function with if db then if thats all firing when you are Activating the Tool

local db = true

function Blow(Hit)
if db then

delete pe?

-- line 109
wait(1)
pe:Destroy()
db = true

Thanks, this sort of works out, however the sword doesn’t work for 1 second after killing a player


I could make the ‘wait’ in line 111 shorter (0.5 seconds for example), but the respawn time is currently 1 second, so that would allow the kill effect to be run twice. And that also means the sword wouldn’t be useable for 0.5 seconds

I’ll continue to work with the script and see if I can figure it out. Thanks

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