Animating Viewmodel / Alternatives To It

I’ve tried animating the viewmodel, because the viewmodel is just a normal character rig with a humanoid and everything but just no legs and its also parented to the character. I’ve tried animating its rig but when i try to play it it gives me the error ‘Cannot Load The AnimationClipProvider Service’
so at this point I’ve given up hope.

But let’s get to the point.

Is there anyway to make the viewmodel arms move with the players arms? so like for an example, when an animation plays in the players rig, the viewmodel arms will be moved with it without being animated?

I do have a script that I’ve been working on for it, if that helps.

local RunService = game:GetService("RunService")
local PhysicsService = game:GetService("PhysicsService")
local Viewmodel = game.ReplicatedStorage.ViewportSetup.ViewportHands:Clone()
local Camera = game.Workspace.CurrentCamera
local Character = script.Parent
local Head = Character:FindFirstChild("Head")


local BodyColors = Character:FindFirstChild("WizardStuff")

if BodyColors then
	local BodyColorsClone = BodyColors:Clone()
	BodyColorsClone.Parent = Viewmodel
end

Viewmodel.Parent = Character

for i, part in pairs(Viewmodel:GetChildren()) do
	if part:IsA("BasePart") then
		part.CollisionGroup = "NoCollisionViewModel"
	end
end

local function Stepped(DeltaTime)
	Viewmodel:PivotTo(Camera.CFrame * CFrame.new(0, -4.5, -1))

	if Head.LocalTransparencyModifier > 0.5 then
		for i, part in pairs(Viewmodel:GetChildren()) do
			if part:IsA("BasePart") then
				part.LocalTransparencyModifier = 0
			end
		end
	else
		for i, part in pairs(Viewmodel:GetChildren()) do
			if part:IsA("BasePart") then
				part.LocalTransparencyModifier = 1
			end
		end
	end

end

RunService.RenderStepped:Connect(Stepped)

from what I’ve heard you can use motor6ds but i wouldn’t know how to.

1 Like

Have you tried making the players Character arms visible instead?

1 Like

i want it to be how it would be in an fps game (arms move up/down with camera) but to do that you have to use viewmodels and i cant figure out how to animate them with it.

1 Like

Still not sure why it’s causing this, it works for me when I tried replicating what you made, could you show the part of the script where it plays an animation? maybe that has smth to do with it

Also have you tried tweening? or is it not possible with what you plan

1 Like

of course, ill add the animation to the script

local RunService = game:GetService("RunService")
local PhysicsService = game:GetService("PhysicsService")
local Viewmodel = game.ReplicatedStorage.ViewportSetup.ViewportHands:Clone()
local Camera = game.Workspace.CurrentCamera
local Character = script.Parent
local Head = Character:FindFirstChild("Head")

local animTrack = Viewmodel.Humanoid.Animator:LoadAnimation(script.HoldAnimation)

--rbxassetid://76397665662047 is the animation id, you can just add a starter one to replicate the problem

local BodyColors = Character:FindFirstChild("WizardStuff")

if BodyColors then
	local BodyColorsClone = BodyColors:Clone()
	BodyColorsClone.Parent = Viewmodel
end

Viewmodel.Parent = Character

for i, part in pairs(Viewmodel:GetChildren()) do
	if part:IsA("BasePart") then
		part.CollisionGroup = "NoCollisionViewModel"
	end
end

local function Stepped(DeltaTime)
	Viewmodel:PivotTo(Camera.CFrame * CFrame.new(0, -4.5, -1))

	if Head.LocalTransparencyModifier > 0.5 then
		for i, part in pairs(Viewmodel:GetChildren()) do
			if part:IsA("BasePart") then
				part.LocalTransparencyModifier = 0
			end
		end
	else
		for i, part in pairs(Viewmodel:GetChildren()) do
			if part:IsA("BasePart") then
				part.LocalTransparencyModifier = 1
			end
		end
	end

end


RunService.RenderStepped:Connect(Stepped)

task.wait(3)
animTrack:Play()

i get the error, Cannot load the AnimationClipProvider Service

but when i do it with the players humanoid it works perfectly. That’s my problem.

Sorry for the late response, now I’m not 100% sure, but maybe add a wait time to the script, my guess is that the script loads before the Viewmodel.

I recommend using :WaitForChild() instead of a wait().

Just so you know for the future, print the variables, if it returns nil then that’s the error. Print the variables that are associated with the error, in this case it’s the Viewmodel and Animation.

1 Like

I’ll try it out but I did i was messing with it and tried it before but it didn’t work out, ill give it a shot though.

I tried it and i still get the same error

Transform i believe, it can simulate the movement of your character (on 3rd person) if you bind it correctly

vmleftarm.Transform = RightArm.CFrame

it is a property for Motor6D

1 Like

make each of the viewmodel arms’s motor6ds match transforms with the worldmodel arms’s motor6ds, put it in a stepped loop

1 Like

thanks! ill try this out, i don’t really work with motor6ds and attachments so ill have to figure it out

I got the Viewmodel to be animated with the players arms, which is awesome but…
its hard to explain, i have a video file here.

robloxapp-20241114-1604313.wmv (1.9 MB)

Hard to Explain Explanation
so basically the viewmodel are rotating/moving with the players arm/animation but every time the player moves, the arm moves offset to the screen and instead of staying where it should be (right in front of the camera) it just moves off into the distance.

Like I said its hard to explain and i recommend just watching the video file but would you guys have any fixes?

also heres the updated script btw

local RunService = game:GetService("RunService")
local PhysicsService = game:GetService("PhysicsService")
local Viewmodel = game.ReplicatedStorage.ViewportSetup.ViewportHands:Clone()
local Camera = game.Workspace.CurrentCamera
local Character = script.Parent
local Head = Character:FindFirstChild("Head")

local LArm = Character:FindFirstChild("Left Arm")
local RArm = Character:FindFirstChild("Right Arm")

local V_LShoulder = Viewmodel.Torso["Left Shoulder"]
local V_RShoulder = Viewmodel.Torso["Right Shoulder"]

local V_Humanoid = Viewmodel:WaitForChild("Humanoid")
local V_Animator = V_Humanoid:WaitForChild("Animator")
local animTrack

--rbxassetid://76397665662047 is the animation id, you can just add a starter one to replicate the problem

local BodyColors = Character:FindFirstChild("WizardStuff")

if BodyColors then
	local BodyColorsClone = BodyColors:Clone()
	BodyColorsClone.Parent = Viewmodel
end

Viewmodel.Parent = Character

for i, part in pairs(Viewmodel:GetChildren()) do
	if part:IsA("BasePart") then
		part.CollisionGroup = "NoCollisionViewModel"
	end
end

local function Stepped(DeltaTime)
	Viewmodel:PivotTo(Camera.CFrame * CFrame.new(0, -10, -1))
	
	

	if LArm and RArm then
		V_LShoulder.Transform = LArm.CFrame --THIS IS WHAT NEEDS FIXING
		V_RShoulder.Transform = RArm.CFrame --ALSO THIS
	end

	if Head.LocalTransparencyModifier > 0.5 then
		for i, part in pairs(Viewmodel:GetChildren()) do
			if part:IsA("BasePart") then
				part.LocalTransparencyModifier = 0
			end
		end
	else
		for i, part in pairs(Viewmodel:GetChildren()) do
			if part:IsA("BasePart") then
				part.LocalTransparencyModifier = 1
			end
		end
	end

end


RunService.RenderStepped:Connect(Stepped)

mainly just focusing on this part here

if LArm and RArm then
	V_LShoulder.Transform = LArm.CFrame --THIS IS WHAT NEEDS FIXING
	V_RShoulder.Transform = RArm.CFrame --ALSO THIS
end

would ToWorldObjectSpace be a way to get this working a little better?

1 Like

figured it out, but it was a variation of what you were talking about, for some reason the animation it was linked to was screwed up, got it fixed and working.