I’m trying to make animations on a viewmodel and player’s character.
The problem is, I’m getting the error “Cannot load the AnimationClipProvider Service.” on line the line where it attempts to load the Monkey ViewModel Animation.
I’ve looked at various posts on this error message but using the solutions did not change anything.
Broken Code
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
local Remotes = ReplicatedStorage.Remotes
local ViewModels = ReplicatedStorage.ViewModels
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character.Humanoid
local ViewModel = ViewModels.ViewModel:Clone()
print(ViewModel)
local MonkeyViewModelTrack = ViewModel.Humanoid.Animator:LoadAnimation(ViewModel.Running) or Camera:WaitForChild(ViewModel.Name)
local MonkeyAnim = script.MonkeyRun:Clone()
local MonkeyTrack = Humanoid.Animator:LoadAnimation(MonkeyAnim)
ViewModel.Parent = Camera
Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if Humanoid.MoveDirection.Magnitude <= .01 and MonkeyTrack.IsPlaying == true then
MonkeyTrack:Stop()
MonkeyViewModelTrack:Stop()
elseif Humanoid.MoveDirection.Magnitude >= .01 and MonkeyTrack.IsPlaying == false then
MonkeyTrack:Play()
MonkeyViewModelTrack:Play()
end
end)
RunService.RenderStepped:Connect(function()
if Player.Character.Humanoid.Health == 0 then
if Camera:FindFirstChild("ViewModel") ~= nil then
Camera.ViewModel:Destroy()
end
end
if Camera:FindFirstChild("ViewModel") ~= nil and Humanoid.MoveDirection.Magnitude >= .01 then
Camera.ViewModel:PivotTo(Camera.CFrame * CFrame.new(.025, -1.5, -1) * CFrame.Angles(0.5, 0, 0))
end
end)