How can I make a running animation stop when I stop running?
I'm making a survival game, and for some reason, when your stamina runs out, your running animation doesn't... this is what I'm working with, (A script in StarterPlayerScripts):
local RunAnim = script.GatherTall
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local RunAnimTrack = hum.Animator:LoadAnimation(RunAnim)
local canSprint = false
local uis = game:GetService("UserInputService")
local animplay = game.Workspace.AnimPlay
uis.InputBegan:Connect(function(Input, gameprocess)
if not gameprocess then
if Input.KeyCode == Enum.KeyCode.LeftShift then
RunAnimTrack:Play()
animplay.Value = true
end
end
end)
uis.InputEnded:Connect(function(Input, gameprocess)
if Input.KeyCode == Enum.KeyCode.LeftShift then
RunAnimTrack:Stop()
animplay.Value = false
end
end)
if hum.WalkSpeed < 30 then
RunAnimTrack:Stop()
end
Someone please help, I haven't been working on this for that long but I'm getting no errors, my code makes sense (at least to me) and my patience is running out for the animations. Could someone also show me how to make a jumping animation play while jumping, and then have the running animation continue after? Idk that would be really helpful, thanks!