Problem with Humanoid.Running

For some reason, when speed = 0. The animation doesn’t stop playing.

hum.Running:Connect(function(speed)
	if speed == 0 and run then
		print(speed)
		
		if Track1 then
			Track1:Stop()
		end

		game.Players.LocalPlayer.Character.Animate.Disabled = false

		hum.WalkSpeed = 16

		local properties = {FieldOfView = DefaultFOV}
		local Info = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0.1)
		local T = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera,Info,properties)
		T:Play()
	elseif run then
		print(speed)
		local now = tick()
		local difference = (now - lastTime)

		if difference <= 0.5 then

			game.Players.LocalPlayer.Character.Animate.Disabled = true

			run = true

			Track1 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Animation)
			Track1:Play()

			hum.WalkSpeed = 20

			local properties = {FieldOfView = DefaultFOV + 15}
			local Info = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0.1)
			local T = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera,Info,properties)
			T:Play()
		end
		lastTime = tick()
    end
end)
1 Like

Are you trying to stop, or pause the animation?

are you trying to make speed of humanoid or anything else ?

I think you have problems because you are disabling the Animate script. Check it out?

I am trying to stop the animation.

No, that isn’t the problem. I have already tested it out

Is supposed to be a sprint script, so I am changing the walkspeed.