How do I only allow rotation on the Y axis?

I have a chassis part that follows a target part. Currently, the chassis rotates freely when it is disturbed (player touching it, part falling on it, etc.). I would like the chassis to rotate only on the Y axis, like a 2D top down car. I do not want to directly set the CFrame of the part. Is there a BodyMover or constraint that can help me?

local RunService = game:GetService("RunService")

local Chassis = workspace.Chassis
local Target = workspace.Target

local BodyGyro = Chassis.BodyGyro
local BodyVelocity = Chassis.BodyVelocity

local Speed = 50
local DecelerationRange = 25

	local TargetPosition =, 5, Target.Position.Z)
	local CurrentPosition = Chassis.Position
	local Difference = (TargetPosition - CurrentPosition)
	local Distance = Difference.Magnitude
	local Direction = Difference.Unit
	local DecelerationFactor = math.min(1, Distance / DecelerationRange)
	BodyGyro.CFrame =, TargetPosition)
	BodyVelocity.Velocity = Direction * Speed * DecelerationFactor

You can use BodyGyro’s MaxForce and put a high number on X and Z axis (40000), this will halt the player from those axis and will only allow the car moving on Y axis.

It’s not ideal when the chassis’s position nears the target’s position.

Nevermind, I’ve managed to make it work.

I tried that with my own builds, but even ‘inf’ seems to still let the player rotate the block.