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

Why can't i load my animation into a character?

Asked by 4 years ago

I've created my own animation in the animation editor and when I try to play the animation it says that the animation failed to load. I have the ID from the url in the search bar.

Heres my code:

local Tool = script.Parent
local humanoid = nil
local drinker = nil
local con = nil
local enabled = false

function onEquipped(mouse)

    humanoid = Tool.Parent:FindFirstChild("Humanoid")
    if humanoid ~= nil then
        drinker = humanoid:LoadAnimation(Tool.Animation)
    end
    con = mouse.Button1Down:connect(function() onButton1Down(mouse) end)

end

function onUnequipped(mouse)

    humanoid = nil
    if drinker ~= nil then
        drinker:remove()
        drinker = nil
    end
    if con ~= nil then
        con:disconnect()
    end

end

function onButton1Down(mouse)

    if enabled then
        return
    end

    enabled = true 


    drinker:Play()
    wait(1)

    enabled = false


end

Tool.Equipped:connect(onEquipped)
Tool.Unequipped:connect(onUnequipped)

1 answer

Log in to vote
0
Answered by
srimmbow 241 Moderation Voter
4 years ago

Here's a way I found to fix it. Add an animation to workspace, put in the code you are using into the ID, and it will change to a different one. Copy and paste that one instead of the one you used.

Ad

Answer this question