I want to make this viewmodel play a certain animation when a key is pressed - But I can’t get the animation to play in the local player when as a viewmodel, even as a loop.
The animation is a simple movement of the arm, where the player moves it closer to the camera to check the watch. This is how it looks when in the workspace, and I was able to play it there.
As a viewmodel, I’m unable to get the animation to play, even though I think it should do it.
The script I used to play it on the SERVER side, on the workspace.
local anim = script:WaitForChild("Animation")
local hum = script.Parent.Humanoid
local AniM = hum:LoadAnimation(anim)
wait(5)
AniM:Play()
AniM.Looped = true
The script I used to attempt to play the animation on the viewmodel while its local
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.Camera
local UIS = game:GetService("UserInputService")
local VM = script.Parent
local hum = VM.Humanoid
local anim1 = Camera.ViewModel.AnimationPlayer["Checking Clock"]
local animA = hum:LoadAnimation(anim1)
while wait(6) do -- This should repeat the animation every 6 seconds I think
animA:Play()
end
--[[
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.V then
animPlay:Play()
print("Tried to play!")
end
end)--]]
Explorer image of the viewmodel’s parts. (There is a LOT more but I am rather sure they are irrelevant to this.)
All parts except for the HumanoidRootPart are unanchored, and set to not collide. There’s a WorldModel inside of it, but I couldn’t exactly find what to do with it, so it ended up just being there, with the PrimaryPart set to the HumanoidRoot. The viewmodel functions by being copied into the localplayer’s camera, and working from there.
I tried looking for solutions, but couldn’t get anything absolutely that said “Do this! It will help!” Does anyone know what is happening? What am I doing wrong? Anything that would make this simpler?