Help to load animation, Cannot load the AnimationClipProvider Service

I want to play animation on model in viewportframe (A tower)

Issue is: Cannot load the AnimationClipProvider Service.

Error happens at:

local animationTrack = animator:LoadAnimation(animationObject)

Animation script:

local function SetAnimation(object, animName)
	local humanoid = object:WaitForChild("Humanoid")
	local animateFolder = frame.Parent:WaitForChild("SummonedFrame"):WaitForChild("Frame"):WaitForChild("Animations")

	if humanoid and animateFolder or animName:IsA("Animation") then
		local animationObject
		if typeof(animName) == "Instance" and animName:IsA("Animation") then
			print("AnimName is animatinon")
			animationObject = animName
		else
			animationObject = animateFolder:WaitForChild(animName)
		end

		if animationObject then
			local animator = humanoid:FindFirstChild("Animator") or Instance.new("Animator", humanoid)

			local playingTracks = animator:GetPlayingAnimationTracks()
			for i, track in ipairs(playingTracks) do
				if track.Name == animName then
					return track
				end
			end

			local animationTrack = animator:LoadAnimation(animationObject)
			return animationTrack
		end
	end
end

local function playAnimation(object, animName)
	local animationTrack = SetAnimation(object, animName)

	if animationTrack then
		animationTrack:Play()
	else
		warn("Anim does not exist")
		return
	end
end

I tried using animation straight as instance, as name, removing animator that already was in a model
(and as object I use tower model (its a dummy to test))

I found out that for some reason, it dont works only for the showing summoned towers
However, it does work for showing what towers can be summoned (using same script)
If I do it on an same model in workspace, it does works too

3 Likes

Nevermind, I got it why it happened
it was because I was not parenting the image label (with viewport in it) yet

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.