You can write your topic however you want, but you need to answer these questions:
**What do you want to achieve? Im trying to get my sprinting animation to stop after the player is done sprinting
What is the issue? Include screenshots / videos if possible! Even though the animation plays fine it will not stop even though i have used the :Stop() function
What solutions have you tried so far? ive tried setting the animation priority to movement, destroying the animation, and looking up different ways to stop an animation. but nothing as worked thus far.
Heres my code:
local sprintSpeed = 22
local walkSpeed = 16
local function beginSprint(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.LeftShift then
local SprintTrack = Humanoid:LoadAnimation(AnimFolder.MovementAnims.Sprint)
SprintTrack.Priority = Enum.AnimationPriority.Movement
SprintTrack.Looped = true
if Sprint == false then
Humanoid.WalkSpeed = sprintSpeed
SprintTrack:Play()
Sprint = true
end
Player.Character.Humanoid.WalkSpeed = sprintSpeed
end
end
end
end
local function endSprint(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.LeftShift then
local SprintTrack = Humanoid:WaitForChild("Animator"):LoadAnimation(AnimFolder.MovementAnims.Sprint)
if Sprint == true then
Humanoid.WalkSpeed = sprintSpeed
SprintTrack:Stop()
Sprint = false
end
Player.Character.Humanoid.WalkSpeed = walkSpeed
end
end
end
end
UIS.InputBegan:Connect(beginSprint)
UIS.InputEnded:Connect(endSprint)
your regetting the sprint animation, I don’t know how true this is because i’m only speaking from experience but just do this
local sprintSpeed = 22
local walkSpeed = 16
local sprintAnim = Humanoid:LoadAnimation(AnimFolder.MovementAnims.Sprint)
sprintAnim.Priority = Enum.AnimationPriority.Movement
local function beginSprint(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.LeftShift then
sprintAnim.Looped = true
if Sprint == false then
Humanoid.WalkSpeed = sprintSpeed
sprintAnim:Play()
Sprint = true
end
Player.Character.Humanoid.WalkSpeed = sprintSpeed
end
end
end
end
local function endSprint(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.LeftShift then
if Sprint == true then
Humanoid.WalkSpeed = sprintSpeed
sprintAnim:Stop()
Sprint = false
end
Player.Character.Humanoid.WalkSpeed = walkSpeed
end
end
end
end
UIS.InputBegan:Connect(beginSprint)
UIS.InputEnded:Connect(endSprint)
local sprintSpeed = 22
local walkSpeed = 16
local sprintAnim = Humanoid:LoadAnimation(AnimFolder.MovementAnims.Sprint)
sprintAnim.Priority = Enum.AnimationPriority.Movement
local function beginSprint(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.LeftShift then
sprintAnim.Looped = true
if Sprint == false then
Humanoid.WalkSpeed = sprintSpeed
sprintAnim:Play()
Sprint = true
end
Player.Character.Humanoid.WalkSpeed = sprintSpeed
end
end
end
end
local function endSprint(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.Keyboard then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.LeftShift then
if Sprint == true then
Humanoid.WalkSpeed = sprintSpeed
sprintAnim:Stop()
Sprint = false
end
Player.Character.Humanoid.WalkSpeed = walkSpeed
end
end
end
end
UIS.InputBegan:Connect(beginSprint)
UIS.InputEnded:Connect(endSprint)
this should work atleast from my knowledge
[/quote/]
that was so obvious lol, thanks!