Cannot Load AnimationClipProvider Service Error

Hello so recently i’ve been receiving this error in game, for sometimes the Bloxikin Morph and sometimes the normal player →

I have been very confused why this happening. The script I am using to animate the character is →

--[[ ANIMATION FUNCTION ]]--

local function playanim(id) -- Local animation function
	if char~= nil and humanoid~= nil then

		local animaID = "rbxassetid://"..tostring(id)
		local oldanim=humanoid:FindFirstChild("Anim")

		if anim ~= nil then -- IF NO ANIMATION
			anim:Stop() -- STOPS
		end

		if humanoid.Sit == true then -- CHECK TO SEE IF PLAYER SAT DOWN
			anim:Stop() -- STOPS ANIMATION IF SO
		end

		if oldanim~= nil then
			if oldanim.AnimationId == animaID then
				oldanim:Destroy()
				return
			end
			oldanim:Destroy()
		end

		local animation=Instance.new("Animation",humanoid)
		animation.Name="Anim"
		animation.AnimationId = animaID
		anim = Animator:LoadAnimation(animation) -- LOADING ANIMATION ONTO HUMANOID
		anim:Play() -- PLAYING IT
		NewBar:ResetBar() -- Resetting Bar
	end
end

I know some people may reply with other topics that are the same as this but It has something to do with my AnimScript function, and I need some help to why this is happening? Other sources

What can make my code more efficient and to stop this weird error?

1 Like