animationTrack:Play() not working right

animation is playing on the server; priority is action but it turns out like this:

I do not want the default walking animation to override it.

THIS IS THE CODE:

local character = player.Character or player.CharacterAdded:Wait()
		local humanoid = character:FindFirstChild("Humanoid")
		local phone = character:FindFirstChild("Phone")
		
		if not phone then
			warn(player.Name, "'s does not have a phone.")
			return
		end
		
		if not humanoid then
			warn(player.Name, "'s does not have a humanoid.")
			return
		end
		
		local animator = humanoid:FindFirstChild("Animator")
		local animation = phone:FindFirstChild("Equipped")
		
		if not animation then
			warn(player.Name, "'s phone does not have an animation.")
			return
		end
		
		if not animator then
			warn(player.Name, "'s does not have an animator.")
			return
		end
		
		local animationTrack = animator:LoadAnimation(animation)
		
		if outcome then
			hideModel(phone, transparency)
			animationTrack:Play(0.2)
		else
			hideModel(phone, transparency)
			for animationCount, animation2 in pairs(animator:GetPlayingAnimationTracks()) do
				if animation.Name == animation2.Name then
					animation2:Stop(0.2)
					break
				end
			end
		end
3 Likes

Video does not work, at least for me

2 Likes

then you have to set the priority to something higher, like two or three. Most Roblox scripts don’t go above one.

1 Like

You might’ve changed the Weight of the Animation.

animation:Play(fade - default is 0.1, weight - default is 1, speed - default is 1)

If that doesn’t work you can try manually changing the Priority through scripts.

animation.Priority = Enum.AnimationPriority.Action

Hope this helps!

this doesn’t work unfortunately; I have tried it already.

it has been set to four, and it still does not work.

did you update the animation and if you created a new one with new ID did you also put in that ID
?

yes, I have. It has never happened to me before so I am confused why it is happening now.

try playing it animation on the client.

I already have, but it still does not work.

do you have custom walk animation

nevrmind you dont I re watched idk how to fix

are you sure it does not work? try now.

hello! Same problem as me last time . U need to know how animation works . The arm will only lock there if they are given a position. Thus , add a node for the lower arms and hands in the animation editor

this still does not work. I added a tiny positioning node on each end of the animation, and it did not work (y = 0.009)?

Did you set the priority before playing the AnimationTrack?

maybe use Animator? like inserting the Animator instance in the AnimationController or something?

local humanoid = character.Humanoid
local Animator  = humanoid.Animator

local track = Animator:LoadAnimation(animation)
track:Play()

Set the animation priority to Action4, which is the highest priority.

Adjust the weight of the AnimationTrack to be higher

sometimes changing properties of animation tracks does not work very well in scripts. i have experience of changing track.Looped = false not working

what i recommend is importing the keyframe sequence from toolbox into workspace and then changing the priority in the properties window then saving it to roblox again.
RobloxStudioBeta_XlUElbWNyQ

I would also refer to @VerySillySausages’s post about how to play an animation track with desired properties if you are concerned about animation weight.