Ad
Log in to vote
0

User keeps dying from Its own attack why?

Asked by 1 month ago

I made a custom character that Is a furnace, and one of Its attacks Is to grab on Into a victim and burn them, dealing 750 damage, the problem Is that It dies from Its own attack which Is pretty annoying and weird

Script:

local Troll = script.Parent
local Grab = Troll.GrabAnim
local PutIn = Troll.PutInside
local CanDamage = false

Troll.GrabEvent.OnServerEvent:Connect(function()
    CanDamage = true
    Troll.Woosh:Play()
    local AnimationTrack = Troll.Humanoid:FindFirstChild("Animator"):LoadAnimation(Grab)
    AnimationTrack:Play()
    wait(0.40)
    CanDamage = false
end)

Troll.Glove1.Touched:Connect(function(hit)
    local Humanoid = hit.Parent:WaitForChild("Humanoid")
    if Humanoid and CanDamage == true and Humanoid ~= Troll.Humanoid then
        local ForceField = Instance.new("ForceField",Troll)
        ForceField.Visible = false
        Troll["Grab lol"]:Play()
        Humanoid.WalkSpeed = 0
        Troll.HumanoidRootPart.Anchored = true
        local Weld = Instance.new("Weld",Troll.Glove1)
        Weld.Part0 = Troll.Glove1
        Weld.Part1 = Humanoid.Parent.Head
        local AnimationTrack = Troll.Humanoid:FindFirstChild("Animator"):LoadAnimation(PutIn)
        AnimationTrack:Play()
        wait(0.60)
        Humanoid:TakeDamage(750)
        hit.BrickColor = BrickColor.new("Burnt Sienna")
        Humanoid.WalkSpeed = 16
        Troll.HumanoidRootPart.Anchored = false
        game:GetService("Debris"):AddItem(Weld,0)
        game:GetService("Debris"):AddItem(ForceField,2)
    end
end)
0
It looks like you've covered most bases for the :TakeDamage part, the only thing I can think of is if it is breaking joints - what happens if you comment out the weld? Try commenting out the Anchored to blowup999 647 — 1mo

Answer this question