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?
This is the line of coding that contains the error:
local Animations = {
["HoldingAnimation"] = ViewModel.AnimationController.Animator:LoadAnimation(ViewModel.Animations.HoldingAnimation)
}
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.
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)
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.