-
What do you want to achieve? Keep it simple and clear!
I’m trying to make a sprinting system. I want the running animation continues after you jump -
What is the issue? Include screenshots / videos if possible!
Whenever you land after jumping, the running animation cancels and plays the walking animation instead. Here’s the video:
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using Humanoid.StateChanged, but it wont play the running animation after landing
Here’s the sprint script i’m using:
uis.InputBegan:connect(function(key, gameprocessed)
if key.KeyCode == Enum.KeyCode.LeftShift and humanoid.MoveDirection.Magnitude > 0 and gameprocessed == false and canRun.Value == true then
humanoid.WalkSpeed = 25
sprinting = true
if humanoid.Health <= 50 then
hurtrun:Play(0.25)
else
animrun:Play(0.25)
end
humanoid.StateChanged:connect(function(_, state)
if state == Enum.HumanoidStateType.Landed then
animrun:Play()
end
end)
while power.Value > 0 and sprinting do
power.Value = power.Value - 0.015
bar.Size = UDim2.new(power.Value / 10, 0, 1, 0)
text.Text = math.floor(10 * power.Value).."%"
tween:Play()
task.wait()
if power.Value <= 0 then
humanoid.WalkSpeed = 16
tween2:Play()
animrun:Stop(0.1)
hurtrun:Stop(0.1)
end
end
if power.Value > 10 then
power.Value = 10
elseif power.Value < 0 then
power.Value = 0.01
end
end
end)