I'm making a survival game and began working on custom animations, and while I was abel to get the animation to run when you press Shift and stop when you let go, it also stops when you press something, jump or click anything while running, whether you're you're still holding Shift or not. This is less of a small help, but more of a favor to ask if someone can show me how to do that, because I simply don't know. Here's what I'm working with by the way: (Local script in StarterPlayerScripts).
local GatherShortestAnimation = script.GatherTall
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local GatherShortestAnimationTrack = hum.Animator:LoadAnimation(GatherShortestAnimation)
local canSprint = false
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(Input, gameprocess)
if not gameprocess then
if Input.KeyCode == Enum.KeyCode.LeftShift then
GatherShortestAnimationTrack:Play()
end
end
end)
uis.InputEnded:Connect(function(Input, gameprocess)
GatherShortestAnimationTrack:Stop()
end)
I would really apreciate it if I could get some help on this, thanks!

1 comment
Thank you! I'm not quite sure how this works, but it does! The only thing I need to do now is make a jump and fall animation and I really hope the running animation will play after landing!