Animation not playing

The link to my animation:

I used the id 12494820540 from the url above

This is my code:

local mineAnim = Instance.new("Animation")
mineAnim.AnimationId = "rbxassetid://12494820540"

local function playAnim(character, animation)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	if humanoid then
		-- need to use animation object for server access
		local animator = humanoid:FindFirstChildOfClass("Animator")
		if animator then
			local animationTrack = animator:LoadAnimation(animation)
			animationTrack:Play()
			print("play")
			return animationTrack
		end
	end
end

game.ReplicatedStorage.RE.OnServerEvent:Connect(function(plr)
    playAnim(plr.Character,mineAnim)
end)

The owner of the animation is my friend though, but I don’t think that’s the problem. When I ran the code, it printed “play” but nothing happened to my character. What’s the problem here? Is it the wrong ID? Or is there a problem with my code?

1 Like

The problem is that the animation is uploaded to a players account and not a group. For animations to be visible to everyone, they must be published to a group, and more specifically, the group that owns the game.
I don’t know why roblox is like that.

You have to own the animation or else it won’t work assuming it hasn’t been uploaded to a group.

Ah ok thanks! I’ll upload the animation by myself and it worked

Hey, I made the animation on the wrong hand (I want it to be on the hand thats holding the pickaxe, which is the right hand). I made another animation but now it wont play. Is it because the right hand is holding a tool?

Edit: I realized that not holding the tool makes it play. How do I make the animation play on the right hand even tho the right hand it holding a tool???

Edit2: Found a fix to this, I just set the priority of it to Action :slight_smile: