Animation Playing When Character Jumps

Hello, this script manages a custom character’s movement although when the player jumps the animation still plays, this is due to the Humanoid.Running although I don’t know of any fix. Help is appreciated.

local Humanoid = script.Parent:WaitForChild("Humanoid")

local WalkAnimation = Humanoid.Animator:LoadAnimation(script:WaitForChild("Walk"))

Humanoid.Running:Connect(function(Speed)
	if Speed > 0 then
		if not WalkAnimation.IsPlaying then
			WalkAnimation:Play()
		end
	elseif WalkAnimation.IsPlaying then
			WalkAnimation:Stop()
	end
end)
1 Like
local Humanoid = script.Parent:WaitForChild("Humanoid")

local WalkAnimation = Humanoid.Animator:LoadAnimation(script:WaitForChild("Walk"))

Humanoid.Running:Connect(function(Speed)
	if Speed > 0 and Humanoid.Jump == false then
		if not WalkAnimation.IsPlaying then
			WalkAnimation:Play()
		end
	else if WalkAnimation.IsPlaying then
		WalkAnimation:Stop()
	end
end)

Alright so this doesn’t work as the function only plays when the character walks as it states, so what I’m trying to find out is an alternative for Humanoid.Running.

local Humanoid = script.Parent:WaitForChild("Humanoid")

local WalkAnimation = Humanoid.Animator:LoadAnimation(script:WaitForChild("Walk"))

Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
	if Humanoid.MoveDirection.Magnitude > 0 and Humanoid.Jump == false then
		if not WalkAnimation.IsPlaying then
			WalkAnimation:Play()
		end
	else if WalkAnimation.IsPlaying then
		WalkAnimation:Stop()
	end
end)
2 Likes