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.
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.
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
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
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.
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
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.