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.
local hum = script.Parent:FindFirstChild("Humanoid")
local humanim = hum:LoadAnimation(script.ReceiverGrab)
wait(3)
humanim:Play()```
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
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.
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
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)
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.
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.