Car flipping is breaking wheel joints

I have tried many times on my car if you want videos/screenshots just ask

Code Below

-- Retrieve the PrimaryPart of the car (assuming it's named "Chassis")
local CarPrimaryPart = car.PrimaryPart


local threshold = 0.5 -- Adjust the threshold to determine when the car is considered tipped over
local checkInterval = 1 -- Time in seconds between each check
local rotationSpeed = 1 -- Speed at which the car is rotated back

-- Function to detect if the car is tipped over
local function isTippedOver()
	local upVector = car.PrimaryPart.CFrame:VectorToWorldSpace(Vector3.new(0, 1, 0))
	return upVector.Y < threshold
end

-- Function to smoothly rotate the car back to its upright position
local function rotateCarUpright()
	local goalCFrame = CFrame.new(car.PrimaryPart.Position) * CFrame.Angles(0, car.PrimaryPart.Orientation.Y, 0)
	local currentCFrame = car.PrimaryPart.CFrame
	local alpha = 0

	while alpha < 1 do
		alpha = math.min(alpha + rotationSpeed * wait(), 1)
		car:SetPrimaryPartCFrame(currentCFrame:Lerp(goalCFrame, alpha))
	end
end

-- Function to reset the car's orientation if it's tipped over
local function checkAndFixCarOrientation()
	while true do
		wait(checkInterval)
		if isTippedOver() then
			rotateCarUpright()
		end
	end
end

-- Ensure the car has a PrimaryPart set
if not car.PrimaryPart then
	car.PrimaryPart = car:FindFirstChild("MainPart") -- Replace "MainPart" with the actual primary part of your car
end

-- Start the orientation check
spawn(checkAndFixCarOrientation)```