Failed to load animation with sanitized ID

All of my animations only work on Studio, none of them work on Roblox servers. They always error “Failed to load animation with sanitized ID”.
They have been published more than a week ago under our Studios name.

Here is the Script:

local function playAnim(player: Player, animId: number, timeout: number?)
	if timeout and timeout <= 0 then
		warn(`[ANIM]: Gave up loading animation {animId} for {player.Name} after too many attempts.`)
		return
	end

	task.spawn(function()
		local ok, err = pcall(function()
			task.wait(0.1)
			local character = waitForFullCharacter(player, 10)
			if not character then
				error("Character not fully loaded.")
			end

			local humanoid = waitForChildOfClass(character, "Humanoid", 5) :: Humanoid
			if not humanoid then
				error("Humanoid not found.")
			end

			local hrp = character:FindFirstChild("HumanoidRootPart")
			if not hrp then
				error("HumanoidRootPart not found.")
			end

			local animateScript = character:FindFirstChild("Animate")
			if animateScript then
				animateScript:Destroy()
			end

			local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)

			local anim = Instance.new("Animation")
			anim.AnimationId = "rbxassetid://" .. tostring(animId)

			local track = animator:LoadAnimation(anim)
			track.Priority = Enum.AnimationPriority.Action
			track.Looped = true
			track:Play(0, 1, 1)
			
			animator.AnimationPlayed:Connect(function(newTrack)
				if newTrack.Animation then
					if newTrack.Animation.AnimationId ~= anim.AnimationId then
						newTrack:Stop()
					end
				end
			end)
		end)

		if not ok then
			warn(`[ANIM ERROR]: {err}`)
			task.wait(1)
			playAnim(player, animId, (timeout or 10) - 1)
		end
	end)
end

It’s only purpose is to start 1 Sitting animation for the player for the rest of the game. Like I said, it never works on Roblox. But I think its not the script since other animations besides the Sititng ones don’t load as well.

Try this to see if your animations even load at all:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://YOUR_ANIMATION_ID"

local track = animator:LoadAnimation(anim)
track:Play()

Run this on the client in StarterPlayerScripts and check if it plays.

also try re-publish the animation asset using the same account or group.

Thank you, republishing the Animations again under the Groups name as well as playing them on the Client worked for me.

Thats good to here put it as solved so if someone else has the same issue they know how to solve it, thank you!

1 Like

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