Jumping animation not working

hi, i am a beginner roblox developer, and i am trying to make a custom jumping animation for my game. however, it…just…doesnt…play? ive tried everything, ive restarted roblox studio, shifted the code around the script, used a more advanced developers script, anything you can think of, yet, nothing works. in fact, i have a running animation script thats almost completely the same, yet it works just fine! i am completely lost. i stayed up until 3 am trying to fix this problem last night and i still cant even figure out how or why it even happens. sorry if this is a bad post, this is my first post

script:

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

local jumpingAnimationId = "rbxassetid://14212683004"
local jumping animation = Instance.new("Animation")
jumpingAnimation.AnimationId = jumpingAnimationId
local play2 = humanoid.Animator:LoadAnimation(jumpingAnimation)

humanoid.Jumping:Connect(function(jumping)
         if true then
            play2:Play()
            if jumping == false then
                play2:Stop()
            end
         end
end)

there are no output errors

When in doubt, check that sweet sweet Priority, baby!

Its just standard procedure, like a tech guru telling the user to turn it on and off again.

So, if you wouldn’t mind, could you tell me what the Animation’s priority is at? To find out the priority, simply start editing the animation, and click the 3 dots in the Animation Editor, go to Set Animation Priority, and absolutely make sure that the animation is set to Movement since you’re trying to modify the player’s default movement animations

1 Like

if you want to do it without scripting and a way that works every time, run the game and get the “animate” localscript from your character, and from there put it in your startercharacterscripts and you’ll find an anim under the script called jumpanim. then you can paste into the id and your done!

1 Like

the running animation (off-topic, but may be important) is movement, the jump animation is action. i also tried putting the jump animation on core, movement, and action4, neither worked

Well, i would leave it at the highest action priority. Then place print statements around to ensure the code is being run. Finally, the only thing i could think of that would break an animation is if, for whatever reason, you dont have permission or access to the animation. IE, the group owns it or whatever

tried it, neither animations played at all after that

tried the print thing for both animations, both print functions fired. i made both of the animations and uploaded them to my account

Are the animations R6 or R15? And is your game R6 or R15?

the animations and the game are both r6

1 Like

In your script, im gonna have to ask you to go VERY verbose with all if statements and prints.
Also, in line 6, you have

local jumping animation = ...

as opposed to

local jumpingAnimation = ...

so. try this:

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

local jumpingAnimationId = "rbxassetid://14212683004"
local jumpingAnimation = Instance.new("Animation")
jumpingAnimation.AnimationId = jumpingAnimationId
local play2=nil
function RemoveTrack()
 if play2 then
     play2:Stop()
     play2=nil
  end
end
humanoid.Jumping:Connect(function(jumping)
  RemoveTrack()
  play2 = humanoid.Animator:LoadAnimation(jumpingAnimation):Play()
  if jumping == false then
       RemoveTrack()
  end
end)

add more ifs

2 Likes

the line 6 thing was actually just a copying error on my end, in the actual script theres no space

will try the script tho

thanks, the script worked; it works perfectly now

1 Like

Sweet! Dont forget to mark it as a solution!

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