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

How to load an Animation?

Asked by
emite1000 335 Moderation Voter
10 years ago

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

Log in to vote
1
Answered by 10 years ago

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.

0
It says "Argument error: must be an Animation object". At line 2. emite1000 335 — 10y
0
aww whoops let me fix that. nighttimeninja314 120 — 10y
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! emite1000 335 — 10y
Ad

Answer this question