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

Need help with this ice kill effect, now working?

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

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.

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