How would I prioritize the jumping and falling animation when im running?
-- local Players = game:GetService("Players")
--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnimation = Humanoid:WaitForChild("Animator"):LoadAnimation(game.StarterPlayer.StarterCharacterScripts.Animate.run.RunAnim)
--//Controls
local MaxSpeed = 45
local animationPlaying = true
--//Functions
LocalPlayer.CharacterAdded:Connect(function(character)
Humanoid = character:WaitForChild("Humanoid")
end)
LocalPlayer.CharacterRemoving:Connect(function()
Humanoid = nil
end)
while true do
if not Humanoid then
continue
end
local timeElapsed = 0
while Humanoid.MoveDirection.Magnitude > 0 do
Humanoid.WalkSpeed = math.min(Humanoid.WalkSpeed + 0.75, MaxSpeed)
if timeElapsed >= 1.5 and not animationPlaying then
animationPlaying = true
RunAnimation:Play()
end
task.wait(0.1)
timeElapsed += 0.1
end
Humanoid.WalkSpeed = 5
animationPlaying = false
RunAnimation:Stop()
task.wait()
end
2 Likes
Hi,
Set the animation priority higher than the running animation.
Animation Priorities: AnimationPriority | Roblox Creator Documentation
How to change it in through scripting: How do I change an animation's priority from a script?
I tried it, and it did not work.
2 Likes
If your running animations priority is lower than the falling & jumping animations priority, then it should work.
Hello!!! If you’re using the default jumping or falling animations and wondering why your custom ones are overriding other animations, there’s something important to know:
By default, the “Animate” script (which is automatically inserted into player characters) sets all animation priorities to Core, regardless of what you set in the Animation Editor.
This means that even if your custom jump or fall animation is set to Action or higher, it will still behave as if it’s Core priority — the lowest — and get overridden by things like walk or idle.
In order to fix this:
- Play the game
- Copy the Animate script from under you character
- Place it under “StarterCharacterScripts”
- Go into the script
- THEN REMOVE THIS LINE
currentAnimTrack.Priority = Enum.AnimationPriority.Core
Hope this helps!
1 Like