How Do I Animate a Viewmodel?

I want to have a holding animation play on my viewmodel

the animation isnt playing despite having tried everything i can find

i cant find any tutorials showing how to animate a veiwmodel they all just say at the end “now just play the animation like normal and there you go”

this is the most recent code i have tried ```local Controller = script.Parent.AnimationController.Animator

local Anim = Instance.new(“Animation”)
Anim.AnimationId = “rbxassetid//:13216038799”
local HoldAnim = Controller:LoadAnimation(Anim)

HoldAnim:Play()```

if anyone knows how to do this i would appreciate some help
Also there is no gun or item being held i just want the animation for now

1 Like

another thing, i do know how to animate ive done it with other stuff so i am aware of the basic proccess of animation

1 Like

Similarly to how you would play an animation outside of the viewport (on Workspace), you can play an animation inside the viewport. Locate where the humanoid is located within the viewport and load the animation into the character. Then play the animation as you would always do.

Im not using the players character im using a separate viewmodel if thats what your saying

I’m pretty sure it’s the same way regardless if it’s a ViewModel or in Workspace in terms of playing the animation. Try playing the animation inside Workspace to see if the animation is configured correctly. Once that is done, you can use the same method, but instead of Workspace, it would be inside ViewModel. Make sure to change the pathing of whatever animation you’re trying to play it on.

Is this a local script installed in the model that is inside the viewmodel?

And I think the Controller variable should be set to script.Parent.AnimationController instead

this is a script inside starter character scripts and the veiwmodel is cloned from workspace also i tried doing script.parent.AnimationController it doesnt work

Im Using a local script inside of startercharacterscripts to animate a clone of the veiwmodel, sorry i should have clarified that and the viewmodel is also only cloned on the client so i server script wouldnt work

you need to have a worldmodel inside of the viewmodel.

Sorry but whats a worldmodel? ive done a lot of research but i havent heartd of that

WorldModel