HingeConstraint Issue (SOLVED)

So basically, I am trying to make a wheel that spins with HingeConstraint Motor type, but there’s a problem, shortly after the wheel starts spinning, it stops. What’s unusual is, the problem only exists if the AngularVelocity is less than 3. If it’s greater than 3, it works fine.

An event called “Spinning” is constantly being fired by another script, the Fly script. If the parameter is true, it spins, if it’s false, the AngularVelocity is set to zero.

Wheel Script:

local RS = game:GetService("ReplicatedStorage")

local Events = RS:FindFirstChild("Events")
local wheel = script.Parent

Events.Spinning.Event:Connect(function(value)
	if value == true then
		wheel.HingeConstraint.AngularVelocity = 1
	elseif value == false then
		wheel.HingeConstraint.AngularVelocity = 0
	end
end)

Fly Script:

local RS = game:GetService("ReplicatedStorage")

local events = RS:FindFirstChild("Events")
local fly = events:FindFirstChild("Fly")
local spinning = events:FindFirstChild("Spinning")

local part = script.Parent
local rotationSpeed = 0

local isSpinning = false
local spinStartTime = 0
local spinDuration = 0

local maxRotationSpeed = 75
local acceleration = maxRotationSpeed / 1.25

local decelerationFactor = 9

function spin()
	local lastTime = spinStartTime
	while isSpinning do
		spinning:Fire(true) -- Event constantly being fired
		local currentTime = tick()
		local elapsedTime = currentTime - spinStartTime

		if elapsedTime < spinDuration then
			if rotationSpeed < maxRotationSpeed then
				rotationSpeed = rotationSpeed + acceleration * (currentTime - lastTime)
				if rotationSpeed > maxRotationSpeed then
					rotationSpeed = maxRotationSpeed
				end
			end
			part.CFrame = part.CFrame * CFrame.Angles(math.rad(rotationSpeed), 0, 0)

			part.RotVelocity = Vector3.new(math.rad(rotationSpeed), 0, 0)

			lastTime = currentTime
		else
			if rotationSpeed > 0 then
				rotationSpeed = rotationSpeed - (maxRotationSpeed / spinDuration) * decelerationFactor * (currentTime - lastTime)
				if rotationSpeed < 0 then
					rotationSpeed = 0
				end
			end
			part.CFrame = part.CFrame * CFrame.Angles(math.rad(rotationSpeed), 0, 0)

			part.RotVelocity = Vector3.new(math.rad(rotationSpeed), 0, 0)

			lastTime = currentTime

			if rotationSpeed == 0 then
				isSpinning = false
				spinning:Fire(false) -- Event is stopped, setting its value to false
			end
		end

		task.wait()
	end
end


fly.Event:Connect(function(duration)
	if not isSpinning then
		isSpinning = true
		spinStartTime = tick()
		spinDuration = duration
		spin()
	end
end)

Video of the issue (AngularVelocity: 1):

Focus on the gray part with 4 cylinders.