Okay, so I have a script that when you're walking and press shift it plays my running animation and increases the characters speed. What I want though is if after you jump and land and are still holding shift it starts the animation again so it's not just doing the walk animation. The reason I don't wanna just deal with pressing shift again is that in the game you need to keep the momentum or you'll most likely have to start over. Heres what I got:
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild('Humanoid')
local RunAnimation = Instance.new('Animation')
RunAnimation = game.Workspace.Flip.Run
RAnimation = Humanoid:LoadAnimation(RunAnimation)
Running = false
function Handler(BindName, InputState)
if InputState == Enum.UserInputState.Begin and BindName == 'RunBind' then
Running = true
Humanoid.WalkSpeed = 50
elseif InputState == Enum.UserInputState.End and BindName == 'RunBind' then
Running = false
if RAnimation.IsPlaying then
RAnimation:Stop()
end
Humanoid.WalkSpeed = 16
end
end
Humanoid.Running:connect(function(Speed)
if Speed >= 10 and Running and not RAnimation.IsPlaying then
RAnimation:Play()
Humanoid.WalkSpeed = 50
elseif Speed >= 10 and not Running and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
elseif Speed < 10 and RAnimation.IsPlaying then
RAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end)
Humanoid.Changed:connect(function()
if ... then -- I tried doing Humanoid:GetState() == Enum.HumanoidStateType.Freefall and Humanoid:GetState() == Enum.HumanoidStateType.FallingDown and Humanoid:GetState() == Enum.HumanoidStateType.Landed here
wait(1)
RAnimation:Play()
end
end)
game:GetService('ContextActionService'):BindAction('RunBind', Handler, true, Enum.KeyCode.LeftShift)
