When I play the game and I hold shift to run, the animation works normally. But when I stop moving and hold shift it plays the animation even without me walking. I want to compare my script with Mortem Metallum running. When you hold shift and stop, it stops the animation.
here is video evidence: https://imgur.com/a/gDtKdwc
here is the script:
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
UIS.InputBegan:connect(function(input)--When a player has pressed LeftShift it will play the animation and it will set the normal walking speed (16) to 35.
if input.KeyCode == Enum.KeyCode.LeftShift then
Character.Humanoid.WalkSpeed = 35
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://myid' --i put this here because this my id, not yours to steal.
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
Character.Humanoid.WalkSpeed = 16
PlayAnim:Stop()
end
end)

2 comments
try what i did, if game.players.localplayer:WaitForChild("Humanoid").Walkspeed == 0 then Anim:Stop()
which line do I put it in since i tried the end and the top?