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

How can i make tool attack animation?

Asked by 1 year ago

i tried to make it but its not working :(

local animl = script.Animation

local tool = script.Parent

local canDamage = false

local player = game.Players.LocalPlayer

local char = player:WaitForChild("Character")

local hum = char.Humanoid

local anim = hum:LoadAnimation(animl)



local function onTouch(otherPart)



    local humanoid = otherPart.Parent:FindFirstChild("Humanoid")



    if not humanoid then 

        return 

    end



    if humanoid.Parent ~= tool.Parent and canDamage then 

        humanoid:TakeDamage(5)

    else

        return

    end



    canDamage = false

end



local function slash()

    local str = Instance.new("StringValue")

    anim:Play()

    canDamage = true

end



tool.Activated:Connect(slash)

tool.Handle.Touched:Connect(onTouch)
0
Do you own the animation? What priority is it? OhManXDXD 445 — 1y

Answer this question