Viewmodel animation won't play?

I made a viewmodel and am trying to play animations i’ve made for it. The model is rigged correctly and has all the needed components but it won’t play at all.
image



	
local hum = script.Parent:FindFirstChild("Humanoid")

local humanim = hum:LoadAnimation(script.ReceiverGrab)
wait(3)
	humanim:Play()```

Make sure your viewmodel has an Animator and AnimationController, and also load animations onto the Animator.

If that doesnt work, make sure youre attempting to load the animations onto the correct model, and that the script even works in the first place.

1 Like

I believe I’m doing those now and it still doesn’t work

https://create.roblox.com/docs/reference/engine/classes/WorldModel

I do not know what to do with this information

Im sorry, I should have been more verbose.

put a WorldModel instance, as a child of your viewport frame
then put your model to animate as a child of worldmodel

I’m not using viewports I’m just cframing it with the camera, and I’m just trying to get the animation to play on the model separate just in the workspace for now

I am so sorry, totally my bad, I misread the title… ugg.

1 Like

Maybe try this:
Parent the model to a local script in StarterPlayerScripts, and then make the local script reparent the model to the camera, and then set its position every frame.

local RunService = game:GetService("RunService")

local ViewModel = script:WaitForChild("ViewModel")
local ViewModelAnimator = ViewModel:WaitForChild("Humanoid"):WaitForChild("Animator")
local GrabAnim = ViewModelAnimator:LoadAnimation(script:WaitForChild("ReceiverGrab")

local Camera = workspace.CurrentCamera

ViewModel.Parent = Camera 

-- When you want the animation to play
GrabAnim:Play()

RunService.RenderStepped:Connect(function(dt)
ViewModel.PrimaryPart.CFrame = Camera.CFrame
end

Ive done this system on a few of my games and it seems to work completely fine.

1 Like

image
image

I keep getting these problems for some reason with this

I know the problem, i made a mistake in the code i supplied.

This should fix the error.

local GrabAnim = ViewModelAnimator:LoadAnimation(script:WaitForChild("ReceiverGrab"))

now i’m back to where it was, it won’t play but there aren’t any errors

is too late maybe, but if you are using welds, try to remove them and rig the viewmodel

1 Like

Can you tell me what do you mean by “Rig the viewmodel” I am facing similar issue, I printed animation.IsPlaying and returned true but Its not even being played

by “rigging” i mean setting up the bones of the viewmodel for the animation, is the same procedure to rig any custom character.

maybe you didnt rig properly your viewmodel and so you cant see its playing an animation, even if is playing

Make sure that the arms itself are not Anchored, except the Root of your ViewModel, I’ve tested this on a Dummy, the animation didn’t play when all the bodyparts were anchored. (for anyone reading this)

1 Like

Has anybody managed to fix this issue? I made my own rig for a ViewModel and it doesn’t seem to replicate any animations whenever it’s made by the client. I copied the ViewModel into the workspace and tried to play animations on it via local scripts, it worked only then. but I can’t afford to use any models already in the workspace just to play two animations.

1 Like

This doesn’t always work, whenever I use the same model in the workspace, animations are functional. Using a ViewModel made by the client doesn’t work even when the model is properly anchored, has an animator, and is not translated to be on top of the camera.

1 Like