Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
3 years ago
Edited 3 years ago

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
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 CalarqnicKen 8 — 3y
0
Edited, sorry I didn't see that part. pwx 1581 — 3y
0
Thx, it works, you're a life saver CalarqnicKen 8 — 3y
0
No worries. pwx 1581 — 3y
View all comments (3 more)
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? CalarqnicKen 8 — 3y
0
Yes, just put the effect code just where it says 'after said player dies...' pwx 1581 — 3y
0
ok thank you CalarqnicKen 8 — 3y
Ad

Answer this question