I would like to change the animation priority to play over walking and jumping. I currently have it so that when E is pressed the player does a frontflip, but the moment they start walking it stops.
I had read this: https://developer.roblox.com/en-us/api-reference/enum/AnimationPriority
I tried doing this. However it returns an error.
local flip = Instance.new("Animation") flip.AnimationPriority = 2
Answer: Just add an event to the humanoid that detects when the player jumps, and play the animation. Rather than doing the front-flip when they press E.
Note: I did this in a
LocalScript
inStarterCharacterScripts
Code:
local char = script.Parent local humanoid = char:WaitForChild("Humanoid") local isJumping = false humanoid.StateChanged:Connect(function(oldState, newState) if newState == Enum.HumanoidStateType.Jumping then if not isJumping then isJumping = true print("Started jump..!") --Play animation here end elseif newState == Enum.HumanoidStateType.Landed then if isJumping then isJumping = false print("Ended jump..!") --[[ You will stop the animation here if you only want it to play during the jump, if you want it to finish playing out then don't. ]] end end end)