I noticed some errors with my sprinting script:
The sprinting animation is broken when i jump: https://media.giphy.com/media/42HL0cLbGI1wXF7jt3/giphy.gif
I can sprint whitout moving: https://media.giphy.com/media/0aT4kvX20qdm3Rjh7F/giphy.gif
Code:
local UIS = game:GetService("UserInputService")
local char = script.Parent
local cam = workspace.CurrentCamera
local runanim = Instance.new("Animation")
runanim.Name = "RunAnim"
runanim.Parent = char
runanim.AnimationId = "rbxassetid://5470703652"
local anim = char.Humanoid:LoadAnimation(char.RunAnim)
UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.X then
char.Humanoid.WalkSpeed = 30
anim:Play()
cam.FieldOfView = 75
end
end)
UIS.InputEnded:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.X then
char.Humanoid.WalkSpeed = 16
anim:Stop()
cam.FieldOfView = 70
end
end)

2 comments
Set the animation priority to Movement. https://developer.roblox.com/en-us/api-reference/enum/AnimationPriority
Ty for helping dude