Animation Priority only working for the client

I am having a problem where animation priority seems not to be replicating to other clients correctly.

In this example, the animation is played from a LocalScript located inside of the GUI. What I have tried:

  • Setting animation priority before and after playing the animation (I have tried every priority type)
  • Setting animation weight values
  • Playing the animation from the server instead
  • Setting the priority from the server instead

Also seen in the video is a problem where the animation will just randomly stop even though it’s looped. I have a feeling this issue is also linked to priority, so that is my main concern right now.

Here is the code inside of the GUI:

    for _, animation in ipairs(animations) do
    	local newButton = baseButton:Clone()
    	newButton.Text = animation[2]
    	newButton.Parent = script.Parent
    	local emote = Instance.new("Animation")
    	emote.AnimationId = "rbxassetid://" .. animation[1]
    	local animationTrack = humanoid:LoadAnimation(emote)
    	table.insert(aInstances, animationTrack)

    	newButton.Activated:Connect(function()
    		if newButton.Text ~= "Stop" then
    		newButton.Text = "Stop"
    		animationTrack:Play()
    		animationTrack.Priority = Enum.AnimationPriority.Action

    		else
    		newButton.Text = animation[2]
    		animationTrack:Stop()
    		end
    	end)
    	animationTrack.Stopped:Connect(function()
    		newButton.Text = animation[2]
    	end)
    end
1 Like

Well is this script made in the server or in the client? (Server script or local script?)

And a thing is that you should put the priority before playing it.

You can’t change the properties of animation track instances on the client. You could use a remote function to create an animation track on the server, and then pass it back to the client

Documentation does not have a [notreplicated] tag for setting priority. I have also tried creating and playing the animation from the server. Just now I tried doing what you said, and the animation doesn’t play. What I did for your method:

  1. Remote event on the server which creates the animation, loads the animation track, sets priority for track, and then passes track to client.
  2. Client calls the play function onto the track instance which was passed.

That’s strange. Maybe try setting the animation priority in the animation editor just as a test and see if that works

Yes!! I stumbled upon this post before making mine:

Setting the priority in animation editor seems to fix it. I tried doing this before making my post but I guess I didn’t export the correct animation. Thank you for your time :slight_smile:

Yeah, this kind of behaviour could be pretty annoying if you want to set or change animation priorities at runtime