Cannot load the AnimationClipProvider service

Hi,
whenever I try to use AnimationController:LoadAnimation() I get the error. It happens only when the ViewModel is outside of Workspace.

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
local viewModel = ReplicatedStorage.ViewModels:FindFirstChild(tool.Name):Clone()
-- If I put `viewModel.Parent = game.Workspace` here then it works, but I want it to stay in the ReplicatedStorage.

local tracks = {
	Idle = viewModel.AnimationController:LoadAnimation(viewModel.Animations.Idle),
	Ready = viewModel.AnimationController:LoadAnimation(viewModel.Animations.Ready),
	Stow = viewModel.AnimationController:LoadAnimation(viewModel.Animations.Stow)
}
1 Like

First, load the animations on the Animator object inside the AnimControl, and then, add a delay between cloning tge VM and loading the animations.

I don’t create the Animator object. It happens automatically. Do you want me to create the Animator object?

If it’s not already there then yeah you should create it.

doesnt work
current code:

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
local viewModel = ReplicatedStorage.ViewModels:WaitForChild(tool.Name)

local animator = viewModel:WaitForChild("AnimationController"):WaitForChild("Animator")
local tracks = {
	Idle = animator:LoadAnimation(viewModel.Animations.Idle),
	Ready = animator:LoadAnimation(viewModel.Animations.Ready),
	Stow = animator:LoadAnimation(viewModel.Animations.Stow)
}

viewModel = viewModel:Clone()

Any errors?

no errors. viewmodel appears in the workspace but doesnt move

i really dont understand why this gives an error. it seems correct i think?

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local camera = game.Workspace.CurrentCamera
local viewModel = ReplicatedStorage.ViewModels:WaitForChild(tool.Name):Clone()

local animator = Instance.new("Animator")
animator.Parent = viewModel:WaitForChild("AnimationController")
local tracks = {
	Idle = animator:LoadAnimation(viewModel.Animations.Idle),
	Ready = animator:LoadAnimation(viewModel.Animations.Ready),
	Stow = animator:LoadAnimation(viewModel.Animations.Stow)
}

It doesn’t move? Do you make it move around?

yeah here is the rest of the code but its irrelevant i think. i need to load the animations for the clone that is in the replicated storage

local function Equip()
	viewModel.Parent = camera
	RunService:BindToRenderStep("ViewModel", Enum.RenderPriority.Camera.Value, function()
		viewModel:PivotTo(camera.CFrame)
	end)
	tracks.Ready:Play(0, 3, 1)
	tracks.Idle:Play(0, 1, 1)
end

local function Unequip()
	for _, track in pairs(tracks) do
		track:Stop()
	end
	tracks.Stow:Play(0, 5, 1)
	tracks.Stow.Ended:Wait()
	if tool.Parent ~= player.Character then
		RunService:UnbindFromRenderStep("ViewModel")
		viewModel.Parent = nil
	end
end

tool.Equipped:Connect(function(mouse)
	Equip()
end)

tool.Unequipped:Connect(function()
	Unequip()
end)

I believe the first parameter of Play is the weight and if it is 0 it doesn’t move. Test with the default value the Creator Hub provides on the AnimationTrack API.

no no first parameter is fade time. my functions are working correctly and playing the idle and action anims as i want. the problem is loading the animations. i have to put the viewmodel in the workspace before i load and i want to avoid that. is there any way to load the animations on clone when its in the replicated storage?

The VM doesn’t have to be in Workspace. Put the model for example, in the Player’s PlayerGui.

before or after :LoadAnimations?

I suggest to do that before. Parent it and then load the animations.