Animation not working

Friend and I are trying to make animation work. We’ve looked at numerous posts and none of them have helped. Any help would be appreciated!

equip.OnServerEvent:Connect(function(plr)
    local char = plr.Character
    local Hum = char:WaitForChild("Humanoid")
    local animator = Hum:FindFirstChild("Animator")
    
    local animation = Instance.new("Animation")
    animation.AnimationId = "rbxassetid://10471119971"
    
    local animationTrack = animator:LoadAnimation(animation)
    animationTrack.Priority = Enum.AnimationPriority.Action
    animationTrack:Play()
    
    print("Animation Played!")
end)

Glad to see someone else using Animator like it was intended.

Anywho, make sure the Universe was created by the same person who created the Animation.

For future work, I recommend playing animations on the client. Client animations will replicate to the server, and it’s better practice to be playing animations from the client.

Set Priority/Looped by clicking the KeyframeSequence object and setting them accordingly, then save to Roblox.
image

Hi! We are in a team create and I am the owner of the animation so would it work if he was the owner of the place?

Ok so if an animation is made on the client it will still show for server?

Yep, it will show up for the server. On the DevForum it is stated to advise doing this, so that’s why I recommend doing it for future work.

hmmm it still isn’t working. I made a new baseplate and copied code

local tool = script.Parent.Tool
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local Hum = char:WaitForChild("Humanoid")

tool.Equipped:Connect(function()
	local animation = Instance.new("Animation")
	local animator = Hum:FindFirstChild("Animator")
	
	animation.AnimationId = "rbxassetid://10471119971"

	local animationTrack = animator:LoadAnimation(animation)
	animationTrack.Priority = Enum.AnimationPriority.Action
	animationTrack:Play()

	print("Animation Played!")
end)

Make sure that the Baseplate is created by you, and that the animation is created by you.

If it is, try this instead:

local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer
local function PlayAnimation(animationId: string): AnimationTrack?
	local Character = LocalPlayer.Character
	if (Character) then
		local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
		if (Humanoid) then
			local Animator = Humanoid:FindFirstChildWhichIsA("Animator") or Humanoid
			local Animation = Instance.new("Animation")
			Animation.AnimationId = animationId
			local AnimationTrack = Animator:LoadAnimation(Animation)
			-- Priority is replicated as well, but you MUST have set the priority to Action from the animation editor, or from the Looped property in the KeyframeSequence instance responsible for the animation
			AnimationTrack:Play()
			return AnimationTrack
		end
	end
end

local Tool = script.Parent.Tool
Tool.Equipped:Connect(function(mouse)
	PlayAnimation("rbxassetid://10471119971")
	print("Animation Played!")
end)

Ok so I remade the animation and I set the priority to Action from the animation itself and looped, but still doesn’t work. I used the same code provided.

Then the creators of the place and animation do not match. Also, make sure the testing environment is a game server, such as seen in team create sessions or server instances (aka playing the game through the Roblox application, not Roblox Studio).

As I said I made a new baseplate and inserted the code and I made the animation from scratch.

The animation is only compatible with R6 avatars.

I read somewhere that the Animator you play an animation on cant be a local created one, but be server created.
Considering the default Animation script in a player’s Character, uses Humanoid, this ‘I read’ creates a local Animator.

So when I was having trouble with animations in my game, I added code to make sure as soon as the server registers a Character has been created, I wait for the humanoid, and wait for Animator, then I replace it with a server created Animator.

I don’t know if this is what allowed my animations to work, as I was trying many things at the time, but I still have this in my code.

Might be something to look into.

yeah my character is r6. I couldn’t figure out the issue so I just gave up lol

An update.

I’ve just experienced this problem as well, and the issue is because of ownership.

While the place may be a team create session originally created by the uploader of the animations, animations still will not load on other accounts. This is probably going to be fixed, so give it time.

I’m working on a new game and I have encountered the same problem.

I got a fix though. First you want to set the Priority to action and then export the animation to a group that the game is in. If the game is yours, then export it to yourself. After that just use the code, it worked for me