How to play an animation with a script?

Hello! I’m basically working on a new project with animations and stuff, and I’m wondering how I could play animations via a script? Do I parent an animation to a player’s character or humanoid?

To preface: make sure you are running your code through a local script.

With that being said, there is a function of Humanoid called “LoadAnimation”, which can be utilized like this:

local Animation = [humanoid]:LoadAnimation(animationObject)
Animation:Play()
1 Like

create script , put into script animation and make script like this

local anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.animation) 
anim:Play()
1 Like