Jump animation plays only when u are running

It’s simple, Humanoids have an event called Running. It’s even nice enough to let you know what the speed was.
In your case, all you have to do is, check if the speed is higher than 0.01 AND you are running, play the animation. Otherwise, stop it.

Still continuing, Example


i think i know the problem. When you press Shift it makes the speed go to 25 which continues the animation thats why Enum.HumanoidStateType.Running wont work

Try replacing loadAnimation:Play() with this:

local root = playersHumanoid.Parent:FindFirstChild("HumanoidRootPart")
if root and root.AssemblyLinearVelocity.Magnitude > 0.2 then
    loadAnimation:Play()
end

All this does is, look for the HumanoidRootPart, and check if its velocity is higher than 0.2 (you won’t have any velocity when standing still)

playersHumanoid.StateChanged:Connect(function(oldState, newState)
	if newState == Enum.HumanoidStateType.Landed and PlayerIsRunning then
		local root = playersHumanoid.Parent:FindFirstChild("HumanoidRootPart")
		if root and root.AssemblyLinearVelocity.Magnitude > 0.2 then
			loadAnimation:Play()
		end
	end
end)

like this? correct?

Nope, in InputBegan.
Landed would make no difference.

OH, lol my bad

char thing

hm, still does the same thing.

it does work for the one if you are standing still it wont play.
but when u stop running it continues to play thats the problem

Can you send the script? I feel like you didn’t do something right in the Running part.

-- MADE BY ADAMTHESHORTKID YOU EXPLOITER.
local uis = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local run = TweenService:Create(workspace.CurrentCamera, (TweenInfo.new)(0.5), {FieldOfView = 80})
local walk = TweenService:Create(workspace.CurrentCamera, (TweenInfo.new)(0.5), {FieldOfView = 70})
local playersHumanoid = game.Players.LocalPlayer.Character.Humanoid
--- Animation Creation
local newAnimation = (Instance.new)("Animation")
newAnimation.AnimationId = "rbxassetid://" .. script:GetAttribute("AnimationID")
loadAnimation = playersHumanoid:LoadAnimation(newAnimation)
-- Walkspeed Changing
local runSpeed = 25
local walkSpeed = 16
-- Variable 
local PlayerIsRunning = false
(uis.InputBegan):Connect(function(Key)

	if Key.KeyCode == (Enum.KeyCode).LeftShift then
		run:Play()
		local root = playersHumanoid.Parent:FindFirstChild("HumanoidRootPart")
		if root and root.AssemblyLinearVelocity.Magnitude > 0.2 then
			loadAnimation:Play()
		end

		playersHumanoid.WalkSpeed = runSpeed
		PlayerIsRunning = true

	end
end)

uis.InputEnded:Connect(function(Key)

	if Key.KeyCode == (Enum.KeyCode).LeftShift then
		walk:Play()
		loadAnimation:Stop()

		playersHumanoid.WalkSpeed = walkSpeed
		PlayerIsRunning = false
	end
end)

playersHumanoid.Changed:Connect(function()
	if playersHumanoid.Jump and loadAnimation.IsPlaying then
		loadAnimation:Stop()
	end
end)

playersHumanoid.StateChanged:Connect(function(oldState, newState)
	if newState == Enum.HumanoidStateType.Landed and PlayerIsRunning then
		loadAnimation:Play()
	end
end)

Well, here’s how it’s done:

playersHumanoid.Running:Connect(function(Speed)
   if Speed > 0.01 and PlayerIsRunning then
       -- Player started moving again
       loadAnimation:Play()
   else
       -- Player stopped
       loadAnimation:Stop()
  end
end)

Put this after StateChanged
If this still doesn’t work, change 0.01 to a higher value.

yessss thank u so muchhh it works.

RIP, one more problem. when i press D or A or any key that move u to the side it restarts the animation

Oh, my mistake. Add " and not loadAnimation.IsPlaying" after “and PlayerIsRunning”
You’ll also need to change the else to an “elseif Speed <= 0.01 and PlayerIsRunning and loadAnimation.IsPlaying then”.

Oh lol alr ill go try.

30 thing

ah there we go. Thanks!

  • 30 again