#Why animation no work

1 messages · Page 1 of 1 (latest)

flint sparrow
#
local tool = script.Parent

tool.Equipped:Connect(function()
    local character = tool.Parent
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local animator = humanoid:FindFirstChild("Animator")
    local uppercut = humanoid:LoadAnimation(script.Animations)
    if not animator then
        animator = Instance.new("Animator")
        animator.Parent = humanoid
    end
    
    
    humanoid:UnequipTools()
end)
compact bobcat
#

animtrack:play()?

flint sparrow
#

Some of it didnt paste for some reason

#
local tool = script.Parent
local animationTrack

tool.Equipped:Connect(function()
    local character = tool.Parent
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local animator = humanoid:FindFirstChild("Animator")
    local uppercut = humanoid:LoadAnimation(script.Animations.uppercut)
    if not animator then
        animator = Instance.new("Animator")
        animator.Parent = humanoid
    end
    
    animationTrack = animator:LoadAnimation(uppercut)
    animationTrack.Priority = Enum.AnimationPriority.Action
    animationTrack:Play()
    humanoid:UnequipTools()
end)
compact bobcat
#

why are you loading it twice thats dum

#
    if not animator then
        animator = Instance.new("Animator")
        animator.Parent = humanoid
    end``` dont do this. never do this
flint sparrow
#

I found the line it fails at

#

it fails here

#

Its says unable to cast value to object

#
local tool = script.Parent
local animationTrack

tool.Equipped:Connect(function()
    local character = tool.Parent
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    local animator = humanoid:FindFirstChild("Animator")
    print("works")
    animationTrack = animator:LoadAnimation("uppercut")
    print("Works1")
    animationTrack.Priority = Enum.AnimationPriority.Action
    print("Works2")
    animationTrack:Play()
    print("Works3")
    humanoid:UnequipTools()
    print("Works4")
end)

New code the print statements are to find the failure points

compact bobcat
#

look up loadanimation in the docs...

zinc flare
#

Yeah, just read the docs that guy sent