Cannot load the AnimationClipProvider Service?

I am making a ViewModel for my FPS game but I have came across this issue when I coded my holding animation: Cannot load the AnimationClipProvider Service?

image

This is the line of coding that contains the error:

local Animations = {
	["HoldingAnimation"] = ViewModel.AnimationController.Animator:LoadAnimation(ViewModel.Animations.HoldingAnimation)
}

The error is occurring on Line 13.

1 Like

Some people have had this error before and they move the viewmodel from replicated storage to the workspace and it starts to work again… try this, and dont forget to redefine location in the script for it.

Ok but in my code I have parented it from ReplicatedStorage to the workspace.CurrentCamera.

Try to start it off in workspace maybe?

Would it help if I sent you the full script?

You can post it here and see if others also know what might be the issue… sure :slight_smile:

Edit: if u dont feel comfortable doing that just put it a section you think is not correct.

Sounds great. Sorry if its pretty big. Here it is:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local ViewModelConfigurationModule = require(ReplicatedStorage:WaitForChild("ModuleScripts"):WaitForChild("ViewModelConfiguration"))

local ViewModel = ReplicatedStorage:WaitForChild("ViewModels"):WaitForChild("ViewModel"):Clone()

local Animations = {
	["HoldingAnimation"] = ViewModel.AnimationController.Animator:LoadAnimation(ViewModel.Animations.HoldingAnimation)
}

local SinSpeed = 2.5
local SinSize = 3
local CosSpeed = 4
local CosSize = 4

local Camera = workspace.CurrentCamera

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Cframe = CFrame.new()

ViewModel.Parent = Camera

Animations["HoldingAnimation"]:Play()

Cframe = ViewModelConfigurationModule.OffsetFromCamera

function PositionViewModel()
	ViewModel:PivotTo(Camera.CFrame * Cframe)
	
	local Sin = math.sin(time() * SinSpeed) / SinSize
	local Cos = math.cos(time() * CosSpeed) / CosSize
	
	if Humanoid.MoveDirection.Magnitude > 0 then
		Cframe = Cframe:Lerp(CFrame.new(ViewModelConfigurationModule.OffsetFromCamera.X + Sin, ViewModelConfigurationModule.OffsetFromCamera.Y + Cos, ViewModelConfigurationModule.OffsetFromCamera.Z), 0.2)
	else
		Cframe = Cframe:Lerp(ViewModelConfigurationModule.OffsetFromCamera, 0.2)
	end
end

RunService.RenderStepped:Connect(PositionViewModel)

So here, try instead to move it to workspace and change its location here, maybe this is the issue.

I have dragged the folder that contains the viewmodel and dragged it into workspace.

I also changed the code to this: local ViewModel = workspace:WaitForChild("ViewModels"):WaitForChild("ViewModel"):Clone()

However, it still prints the same error in the output.

Sorry can you show which line 13 is the error?

Sure thing:

local Animations = {
	["HoldingAnimation"] = ViewModel.AnimationController.Animator:LoadAnimation(ViewModel.Animations.HoldingAnimation)
}

Im a bit confused but why are there brackets? Maybe remove them?

Edit:

local Animations["HoldingAnimation"] = ViewModel.AnimationController.Animator:LoadAnimation(ViewModel.Animations.HoldingAnimation)

Yes I have only just realized that and have no clue why that was there. Sadly, for some reason this is happening:

image

Change the whole name it doesnt need brackets… just use AnimationTrack in both places so you define it and then use it to run the play track.

You only have one animation so you dont need brackets thats for a table of animations, which you can call up by name later… but u only have one so just define it the way i said… it shouldnt error.

WHAT!!! That should’ve worked.

local HoldingAnimation = ViewModel.AnimationController.Animator:LoadAnimation(ViewModel.Animations.HoldingAnimation)

HoldingAnimation:Play()

Very sus :face_with_monocle:

2 Likes

You also need to define the animation ID. Here look at the Rolbox doc on loading animation tracks…scroll to bottom for example:

https://developer.roblox.com/en-us/api-reference/function/AnimationController/LoadAnimation

1 Like

Yes I know. I set the AnimationId here:

image

Not to sure why its not working…

Try to parent the viewmodel to the game.workspace in your script instead of camera.

This line:

Tried it. Sadly not working.

ViewModel.Parent = workspace

No error? Sometimes its wierd with spelling, try game.Workspace

Sadly thats my final suggestion… hopefully someone else can chime in.