I need animation help

I’ve got a quick and simple question that has been bugging me for pretty much an entire year now, but it’s critical I have it solved now.

The first time AnimationTracks are :Play()ed in on a humanoid, it’s extremely jittery and has a sort of ‘choppy’ behavior. After the first time though, the next time the animation is called to play it runs perfectly fine. I’ve tried ContentProvider:PreloadAsync(), but the issue still persists. Why is this happening?

As long as you call LoadAnimation on the Humanoid beforehand, you should not be experiencing this.

Can you possibly send us some some footage of this happening, as well as a snippet of your code, so we can help you pinpoint the problem?

What exactly are you animating in this animation?

1 Like

Yes. It’s extremely weird because even after LoadAnimation is called correctly the behavior still happens.

This is the server code snippet that shows that the animations are all preloaded correctly:

local Weapon = script.Parent.Parent
local Animations = game.ServerStorage.Animations.Single
local CP = game:GetService('ContentProvider')
local Action = Weapon.Action
local Config = Weapon.Configuration

local Speed = Config.Speed.Value / 10
local Weight = Config.Weight.Value

repeat wait() until script.Parent.Parent.Parent.Parent.Character
local Humanoid = script.Parent.Parent.Parent.Parent.Character:FindFirstChildOfClass('Humanoid')

CP:PreloadAsync({Animations})
local Equip = Humanoid:LoadAnimation(Animations.Equip)
local Idle = Humanoid:LoadAnimation(Animations.Idle)
local Block = Humanoid:LoadAnimation(Animations.Block)

local Attack1 = Humanoid:LoadAnimation(Animations.Attack1)
local Attack2 = Humanoid:LoadAnimation(Animations.Attack2)
local Attack3 = Humanoid:LoadAnimation(Animations.Attack3)
local Attack4 = Humanoid:LoadAnimation(Animations.Attack4)

Only look at the block event here. This is where it’s mainly noticeably happening.

Action.OnServerEvent:Connect(function(plr, event)
	if event == ('Equip') then
		
		HandleEffects(true)
		Idle:Play(0.1, Weight, Speed)
		
	elseif event == ('Unequip') then
		
		HandleEffects(false)
		Idle:Stop(0.12)
		
	elseif event == ('Block') then
		
		Block:Play(0.1, Weight, 1)
		plr.Character.Humanoid.WalkSpeed = 6
		
	elseif event == ('Unblock') then
		
		Block:Stop(0.15)
		plr.Character.Humanoid.WalkSpeed = 16
		
	end
end)

In this video, you can see that when I begin block for the first time it ‘cuts’ to the blocking position, which is abnormal behavior because, with the fade time and weight adjusted accordingly, it should smoothly interpolate into the animation. When I block a 2nd time, you can see the correct behavior is displayed.

1 Like

(reply notification, see the above update I posted)

Just out of curiosity, why are you loading and playing the animations on the Server, since animations replicate?

The Developer Hub page on AnimationTracks states that it should be done from the client.
Screenshot_2020-08-20-21-00-39

Also, you should probably preload the Tool, just in case loading it into view takes up processing power and delays the animation.

I’m going to handle them on the client. No idea why I didn’t refer to the developer hub before making this system. It’s a win-win, will most likely fix my issue, and will reduce server stress.

Why would I need to preload the tool? PreloadAsync goes through the instances passed through the array and their descendants, and loads the content if the instance’s properties contain an ID. What benefit would preloading the tool do? The animations are in ServerStorage. (moved to replicated when I fix this for running them on client)

The assets inside the Tool might not load until the tool is equipped, meaning you get delay when equipping it due to the assets loading. This has nothing to due with your issue, but is something I normally do.