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.
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).
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.
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