Help on Animation being Overlapped

Hello DevForum. I’m trying to create a successful sprinting animation, however it seems like the sprinting animation is being overlapped by my idle or walking animation. (I provided my sprinting animation compared to the ingame one below)

I tried using :GetPlayingAnimationTracks() to stop the current animations already being played but it doesn’t seem to be working. Here is the script I used:

local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()

local Keybind = "LeftShift"

local StaminaCount = MaxStamina

UIS.InputBegan:Connect(function(key, processed)
	if key.UserInputType == Enum.UserInputType.Keyboard then
		if key.KeyCode == Enum.KeyCode[Keybind] and StaminaCount > 0 then
			StaminaUsed.Value = true
			for i, track in pairs (AnimationTracks) do
				track:Stop()
			end
			PlayAnim:Play()
		
		end
	end
end)
UIS.InputEnded:Connect(function(key, processed)
	if key.UserInputType == Enum.UserInputType.Keyboard then
		if key.KeyCode == Enum.KeyCode[Keybind] then
			StaminaUsed.Value = false
			PlayAnim:Stop()
		end
	end
end)

This could be because to move while sprinting, you would press W (walking animation ) but I have tried merging the two KeyCodes already in this script, but it didn’t work out. I’m also seperating where the walking animation and running animation are if that somehow creates a problem.

When you upload an animation, make sure to set it’s animation priority to something like action
image


Alternatively, you can adjust the animation track’s Priority property via script

track.Priority = Enum.AnimationPriority.Action

https://create.roblox.com/docs/reference/engine/classes/AnimationTrack#Priority
https://create.roblox.com/docs/reference/engine/enums/AnimationPriority

I usually set all my animations priority higher than Action though (here the running animation is set to Action4)

Apologies, read the initial post wrong


I’d recommend having your idle animation set to action, then your walking animation to action2, then the throw animation to action3 (something along those lines)

This is because Roblox changed their animation system to instead combine (merge) animations, rather than have the last animation triggered overlap any other animation (with the same priority)

1 Like

No worries, I’ll try that then and see if it works hopefully

I just tried it out and it didn’t seem to solve the problem, however it might just be my fault though.
I set my walking animations to Action2, Idle animation to Action, Jump Animation to Action3, Throw animation to Action3, and Sprint Animation to Action4 but it ended up making the player only play the idle animation. (Note that I set the ToolNoneAnimation with the same idle animation so it might just mean all the animations stopped working lol)

I might have done something wrong when changing the priorities by script but here is how I did it:

local forwardWalk = Instance.new('Animation')

forwardWalk.AnimationId = 'rbxassetid://11416231577'

forwardWalk.Parent = script

forwardWalk.Name = 'forwardWalk'

forwardWalk.Priority = Enum.AnimationPriority.Action2

(essentially I just placed all the priority scripts at the end of each varible)

Fixed, I placed the priority function in the wrong place originally

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