Hello i have some problems with my sprinting script because it doesn't change the animation from walking to running and only works when i stop and start moving again
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Cam = workspace.Camera
local NormalSpeed = 16
local SprintSpeed = 33
local Sprinting = false
mouse.KeyDown:connect(function(key)
if key:byte() == 48 then
if Sprinting == false then
player.Character.Humanoid.WalkSpeed = SprintSpeed
Sprinting = true
Cam.FieldOfView = 80
player.Character.Animate.walk.WalkAnim.AnimationId = ("rbxassetid://6708766874")
elseif Sprinting == true then
player.Character.Humanoid.WalkSpeed = NormalSpeed
Sprinting = false
Cam.FieldOfView = 70
player.Character.Animate.walk.WalkAnim.AnimationId = ("rbxassetid://6706074754")
end
end
end)
this is the sprint script
