Jittery Animation when transitioning to another animation

Hello Devs,

I have recently been working on robotic tv character that can switch from tv mode to robotic mode. Unfortunately I have been having issues with the transform animation. Whenever I view the animation from the server, or another client the animation appears jittery. However when viewed from the character’s client it works perfectly.

I would like for the animation to be smooth.

Client:


Server:

This is my current animation code (local script inside the character):

game:GetService("UserInputService").InputEnded:connect(function(input,IsTyping)
	if IsTyping then return nil end
	if input.KeyCode == Enum.KeyCode.E then
		if debounce == true then
			debounce = false
			if isStanding == true then

				isStanding = false
				walktrack:Stop()
				Standingidletrack:Stop()
				TransformTrack:Play()

				wait(1)

				Sittingidletrack:Play()

				wait(debouncetime)
				debounce = true

			else if isStanding == false then

					isStanding = true

					debounce2 = true

					Sittingidletrack:Stop()
					TransformTrack:Play(0, 1, -1) -- Transform animation but in reverse

					wait(1)

					Standingidletrack:Play()

					wait(debouncetime)
					debounce = true
				end
			end
		end
	end
end)

image

(Apologies for the not so great code. If you would like to explain anything about the script, let me know)

If anyone could please help me fix this problem or point me in the right direction, that would be greatly appreciated.

Can you play the animation in the server instead? Playing it on the server will replicate to every client. Playing in the client also replicates on the server and other clients but it will become “laggy” because of the client’s internet connection (ping).

Wouldn’t that just make it jittery for all clients? Again, I want the animation as smooth as possible. I can try it, but I don’t think its a good idea.

Can you show Standingidletrack and TransformTrack

This?

local WalkingAnim = script:WaitForChild("WalkingAnim")
local SittingIdleAnim = script:WaitForChild("SittingIdleAnim")
local StandingIdleAnim = script:WaitForChild("StandingIdleAnim")
local TransformAnim = script:WaitForChild("TransformAnim")

local walktrack = humanoid.Animator:LoadAnimation(WalkingAnim) -- Walking
local Sittingidletrack = humanoid.Animator:LoadAnimation(SittingIdleAnim) -- Sitting (tv off position)
local Standingidletrack = humanoid.Animator:LoadAnimation(StandingIdleAnim) -- Tv on position (normal idle)
local TransformTrack = humanoid.Animator:LoadAnimation(TransformAnim) -- The transform animation between standing and sitting

I know its not the best looking, But the animations do work (Just not the transition between animations)
Im currently trying to get the animations to work on the server.

it is impossible (i think) because each clients have different pings

I managed to figure it out. For anyone wondering how, I just had to rearrange my script and change the animation priority for the transform animation.

game:GetService("UserInputService").InputEnded:connect(function(input,IsTyping)
	if IsTyping then return nil end
	if input.KeyCode == Enum.KeyCode.E then
		if debounce == true then
			debounce = false
			if isStanding == true then

				isStanding = false
				walktrack:Stop()
				
				TransformTrack:Play(0, 1, 1)
				
				Standingidletrack:Stop()
				
				Sittingidletrack:Play()
				
				Remote:FireServer("Sitting", "TV")

				TransformTrack.Stopped:Wait()

				wait(1)
				debounce = true
				
			else if isStanding == false then

					isStanding = true

					Remote:FireServer("StopMonke", "TV")
					debounce2 = true

					TransformTrack:Play(0, 1, -1)
					
					Sittingidletrack:Stop()
					
					Standingidletrack:Play()
					
					TransformTrack.Stopped:Wait()
					
					Remote:FireServer("Standing", "TV")

					wait(1)
					debounce = true
					
				end
			end
		end
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.