My problem is that I made a sprint key , but when I jump while the sprint key is active, the the jump animation does not happen. I wanna learn how to fix this so that no animation overlays the other. Practically I wanna know how to stop and start in between animations. Here's my code to understand more of what I mean.
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local hum = game.Workspace:WaitForChild("Humanoid")
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.LeftControl then
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://5150687024'
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
Character.Humanoid.WalkSpeed = 50
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
Character.Humanoid.WalkSpeed = 16
PlayAnim:Stop()
end
end)
