Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to load an Animation?

In the Workspace I have an Animation called "Anime". When a GUI TextButton is clicked, I want an animation to load into the Humanoid of a model. But when I click the button, I'm just presented with the error "Humanoid is not a valid member of Player".

script.Parent.MouseButton1Click:connect(function()
	Anim = script.Parent.Parent.Parent.Parent.Humanoid:LoadAnimation(Anime)
end)

Now I am sure that I have the correct number of .Parent's to get me to the Player's character (this script is a far descendant in the Character). So what am I doing wrong?

(P.S. this is my first ever time using Animations so sorry this is such a nooby question)

1 answer

✓ Accepted answer

Do this with a local script

script.Parent.MouseButton1Click:connect(function()
local Anime = workspace.Anime
    Anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anime)
Anim:Play()
end)

you need to play the animation in order for you to actually preform it.

Tell me if that works.

3 comments

0

It says "Argument error: must be an Animation object". At line 2.

0

aww whoops let me fix that.

0

Oh so all I had to do was define what Anime was? -_- Well that's ridiculous (I was just going off the "Animations" Wiki page for help). Thanks for solving!

This discussion is preserved as it was. New answers, comments, and votes are closed.