Animation glitches first time played

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Want to have consistent animation track playing along with a consistent keyframe.
    I am aware of keyframereached function, but this still creates the same exact issue with timing.

  2. What is the issue? Include screenshots / videos if possible!
    Animation issues - YouTube

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

  • Preloading
    image

  • The keyframes are consistent enough, but the core issue is that the animation is not playing properly the first time as shown in the video. You can see the keyframe lengths are about the same.

  • Animation priority set to action!

Here is the important part of the code.

Tool.Unequipped:Connect(function()
	if loaded == true then
		
		if Shield then
			Shield:Destroy()
			Shield = nil
		end
		
		if EquipTrack then
			EquipTrack:Stop()
			EquipTrack = nil
		end
		
		if char.Humanoid.WalkSpeed <= 13 then 
			char.Humanoid.WalkSpeed = 16
		end
		
		
	end
end)




Tool.Equipped:Connect(function()
	if loaded == true then
		
		if Tool.Parent and Tool.Parent.ClassName == "Model" and Tool.Parent:FindFirstChild("WeldFolder") 
		   and Tool.Parent:FindFirstChild("HumanoidRootPart") and Tool.Parent:FindFirstChild("Left Arm") then
			
			char = Tool.Parent
			
			if not Shield then
				CreateShield(char)
			end
			
			
			EquipTrack = char.Humanoid:LoadAnimation(Animations.Equip)
			local OldEquipTrack = EquipTrack
			
			local Speed = 1
			local Length = EquipTrack.Length
			local keyframe = EquipTrack:GetTimeOfKeyframe("Hold")
			EquipTrack:Play(0.100000001,1,Speed)
			
			local t = tick()
			wait(keyframe/Speed)
			print("Keyframe length: ",tick()-t)
			
			
			if Tool.Parent == char and OldEquipTrack == EquipTrack then
				EquipTrack:AdjustSpeed(0) -- stops animation
			end
			
		end
	end
end)
2 Likes

For anyone who is wondering. If you preload the animation on Server And Client this glitch will dissapear.

5 Likes

Okay but this was made may 20 that means this is past i,m not try to be rude just saying.

Yeah you don’t sound rude so thats fine. If anything it’s gonna help out those who were wondering about the issue. The problem is still occuring so it wont be past until they patch it :slight_smile:

1 Like

and it helped me lmao just saying

Sorry to revive this thread again, but it’s enough to just preload the animations on the client ;).

Sorry to revive again but preloading on both fixed it for me because I played the animations on the server not client.

1 Like