How would I make a kill effect for the classic sword?

I asked this question in the past, but I was unable to successfully make a kill effect. I know how I can make an effect, I’m just not sure how I can trigger one when a player kills an opponent player with their sword

I am using the classic sword/ linked sword.

Any help or guidance would be very appreciated, thanks.

You could check the health of the player that the sword hits, and if it reaches a desired point you could just run code.

if hit.Parent:FindFirstChild("Humanoid").Health <= 0 then
 --kill effect here
end
1 Like

where would this go in the swordScript?

It would go inside of the Blow() function. This is because this function takes the part which the sword hits as a parameter. If you want, here’s the exact code which should work (put this after “character” is declared):

if character:FindFirstChild("Humanoid").Health <= 0 then
--kill effect here
end

sorry for the late reply, so I put a print to test if anything would do anything but i did not get the printed statement when killing a player. I am unsure what I did wrong

It works for me. You may have put it in the wrong place. Look for this section of code:

local character = Hit.Parent
	if character == Character then
		return
	end

put this after the “end”:

if character:FindFirstChild("Humanoid").Health <= 0 then
		print("Player Killed")
	end

I hope this helps!

1 Like

Thank you so much, I’ve been trying to do this for months and i finally know how. I cannot thank you enough. :+1:

1 Like

Happy to help! Good luck with the kill effect.

1 Like