Problem after Playing Animation in a Player

I have this GUI that plays an animation to the user via server.

It works, but once I move and click the Button again it doesn’t play the animation anymore.

My Script:

-- ServerScriptService
local RP = game:GetService("ReplicatedStorage")
local event = RP:WaitForChild("TestEvent")

event.OnServerEvent:Connect(function(sender)
	local Character = sender.Character
	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	local Animator = Humanoid:FindFirstChildOfClass("Animator")
	
	
	if Humanoid and Animator then
		local Animation = Instance.new("Animation")
		Animation.AnimationId = "rbxassetid://3695333486"
		
		Animator:LoadAnimation(Animation):Play() -- Play
		print("Playing animation")
	end
	
end)

-- Localscript
local RP = game:GetService("ReplicatedStorage")
local event = RP:WaitForChild("TestEvent")

script.Parent.MouseButton1Click:Connect(function()
	event:FireServer()
end)
2 Likes

Do you get any errors? Does the script print “Playing animation”?

I didn’t get any errors and yes it prints out the “Playing animation”.

Try checking if clicking the button second time fires the server. Add a line

print("Event Fired") inside the MouseButton1Click function

After I clicked the button:

After I moved and clicked the Button again:

Maybe the cause of this is the Priority of the animation?

If so, how do I modify it to maximum priority so even if the Player moves the animation will not stop?

Edit: The animation id is came from Roblox’s Hype dance (Free source)

You can do “Animation.Priority = (whatever priority you want)”

Animation doesn’t have a Priority properties based on this Documentation:

Alright I found a “hacky” way to do this:

You go inside the Animation Editor and click the 3 dots on the upper left, then you click “Import” and “From Roblox”. Input the ID into the bottom and click “Submit”. Then you can set it’s priority from there.

eeee

image

I’ve gone and done that for you already, here is the ID:

rbxassetid://6316306488

1 Like

Kinda works now. Thanks for helping.

To future researchers that has the same problem:

  • The solution of this topic is the Priority level of an animation.
  • Making an animation and setting the Priority level to Action will fix it.