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, not working that well?

Asked by 3 years ago

--[[local Players = game:GetService('Players') local toolName = script.Parent

Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded.Humanoid:Connect(function(Character) local Humanoid = Character:FindFirstChild("Humanoid").Died:Connect(function() if Character:FindFirstChild(toolName) or Player.Backpack:FindFirstChild(toolName) then local Iceblock = Instance.new("Part", workspace) part.Size = Vector3.new(10,10,10) part.Position = Character.HumanoidRootPart.Position part.Transparency = .6 part.Anchored = true end -- check tool name end) -- Died end) -- CharacterAdded end]]

If there are brackets it is because I was trying the code stuff.

1 answer

Log in to vote
0
Answered by 3 years ago

uhhhh dos dis work hehe

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character) 
        local HumanoidRootPart = character:WaitForChild'HumanoidRootPart'
        local Humanoid = character:WaitForChild'Humanoid'
        Humanoid.Died:Connect(function() 
-- finds killer cause I don't think you want your own kill effect.
        local creator = Humanoid:FindFirstChild'creator'
        if creator ~= nil then
            local killer = creator.Value
            for i,v in pairs(killer.Character:GetChildren()) do
            if v:IsA'Tool' then
-- make this your tool name 
                if v.Name == 'ToolThatMakesEffect' then
                    local Iceblock = Instance.new("Part", game.Workspace) 
                    Iceblock.Size = Vector3.new(10,10,10)
                    Iceblock.Position = HumanoidRootPart.Position
                    Iceblock.Transparency = .6
                    Iceblock.Anchored = true
                end
            end
        end
    end)
end)


Ad

Answer this question