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

Need help with this ice kill effect, now working?

Asked by 3 years ago

Im trying to make it so that when you die by ice sword you get this ice death effect. Im doing it so that you insert a non collidible block that is supposed to be ice, buts its not working, here is the script.

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

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 local part = torso = local.player
end end) end) end)

1 answer

Log in to vote
0
Answered by
ud2v3cf 35
3 years ago
Edited 3 years ago

Next time, please put your code inside a code block with the following:

--[[

-- code here

]]

You're current code is defunct. If I were to guess what your current code is doing, I basically will apply the ice effect to the player WITH the ice sword, and not the player KILLED by the ice sword. Since there is no native way to find the killer of an humanoid, you have to manually add some sort of logic. I recommend tagging a player with some sort of InstanceValue. You then check is the value of that (the killer) has the ice sword.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
        Player.CharacterAdded:Connect(function(Character)
                local Humanoid = Character:WaitForChild("Humanoid")
                Humanoid.Died:Connect(function()
            local killer = Character:FindFirstChild(SOME_TAG)
            if killer and killer.Value then
                if check if "killer" has the sword then
                    local ice = iceEffect:Clone()
                    ice.Parent = Character
                end
                    end)
            end)
    end)

I left some blanks for you to fill in.

Ad

Answer this question