" LoadAnimation requires an Animation object - Client:9" Despite the passed in object being an instance of an Animation object?

  1. What do you want to achieve?
    When the user inputs a mouseButton1 click, the animation plays.

  2. What is the issue?
    It returns the error: LoadAnimation requires an Animation object - Client - LocalScript:9. The animation is infact an animation object.

  3. What solutions have you tried so far?
    Nothing. I couldn’t find anything on this topic that EXACTLY matched my error.

local inputService = game:GetService("UserInputService")
local anim = game:GetService("ReplicatedStorage"):WaitForChild("SlapANIM")


inputService.InputBegan:Connect(function(inp, _gameProc)
	if inp.UserInputType == Enum.UserInputType.MouseButton1 then
		local plr = game.Players.LocalPlayer
		--make the user play the animation anim
		print(anim.ClassName)
		plr.Character.Humanoid:LoadAnimation(anim):Play()
	end
end)

Things to note

  • When I print the ClassName it says it’s a KeyFrameSequence which I don’t know if that means it is an animation or not. I don’t want to use a animation link.

Make sure the animation is an Animation Instance. You may need to publish your animation to roblox. In order for the animation instance to work, you need the animation ID, which shows after publishing it through the Animation Editor Plugin.

You can read this for more help:

Hope this helps!

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