Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a kill effect, that only happens if you die by a SPECIFIC weapon?

I really need help with this. Im trying to make a sword fighting game where you can buy different swords with cool effects. I want to make it so that if you die by a SPECIFIC sword, theres a SPECIFIC death effect. For example, if theres a ice sword, and you die for it, you die a ice kill effect, then if theres a fire sword and you die from it, you die from a fire kill effect. Can anyone help me?

1 answer

For future reference, please have an attempt on what you want to do before you ask (many people treat this as not a request site).

local Players = game:GetService('Players')
local toolName = 'WeaponNameGoesHere'

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid = Character:WaitForChild('Humanoid')
		Humanoid.Died:Connect(function()
			if Character:FindFirstChild(toolName) or Player.Backpack:FindFirstChild(toolName) then

			-- here, after said player dies is where the effect would be
			end -- check tool name
		end) -- Died
	end) -- CharacterAdded
end) -- PlayerAdded

7 comments

0

Ok sorry I wont do it next time, but I want it so that a specific death effect happens when you die form a specific sword

0

Edited, sorry I didn't see that part.

0

Thx, it works, you're a life saver

0

No worries.

0

Also for the here after said the player dies is where the effect would be, do I jsut put in the script for the death effect?

0

Yes, just put the effect code just where it says 'after said player dies...'

0

ok thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.