Making a part face another part using angularvelocity?

local rotate = script.Parent.Parent.Parent.Parent.AttackAim
local part = script.Parent.Parent.Parent.Parent
local object = script.Parent.Target.Value
rotate.MaxTorque = Vector3.new(0,20000000,0)
rotate.CFrame = CFrame.new(part.Position, object.Position)

this is typically how I rotate parts/models, I use a BodyGyro.
but the model does not rotate unless I move it up a little on the studio.
after making sure nothing is preventing it from rotating properly I decided I should use the angularvelocity bodymover instead. but how should I proceed? does BodyAngularVelocity have a CFrame to change? can AngularVelocity be used as a substitute?

Why don’t you make the MaxTorque Vector3.new(math.huge, math.huge, math.huge)?

Is there any reason you don’t want the X and Z rotations to change?

yes, the model involved is only allowed to rotate on the Y axis with the given bodygyro.

Maybe you could try using an AlignOrientation instead, since that is the direct successor of the BodyGyro.

In a setup like this, you can instance a proxy part locally with the CFrame.lookAt(part.position, object.Position) CFrame, and put an attachment on the proxy and the part that the BodyGyro would be acting on, then edit its properties:

local proxy = Instance.new("Part") do
	proxy.CanCollide = false
	proxy.Anchored = true
	proxy.Transparency = 1

	local Attach = Instance.new("Attachment")
	Attach.Parent = proxy
end
proxy.CFrame = CFrame.lookAt(part.position, object.Position)
proxy.Parent = workspace

local AlignOrientation = -- the align orientation acting on the part

AlignOrientation.Attachment0 = -- part.Attachment in theory,
-- it should already be on the part just to save time

AlignOrientation.Attachment1 = proxy.Attachment

-- this should already be disabled, so you wouldn't really need this
AlignOrientation.ReactionTorqueEnabled = false
-- play with its other properties until it works

-- set the proxy's CFrame in a loop

theres a problem at the line “local AlignOrientation =” an unexpected symbol.

and also, is the reason why you recommend this method compared to using angularvelocity?

You have to supply the AlignOrientation yourself, and the same for AlignOrientation.Attachment0 =. This is not meant to be copy paste run, you have to supply some of the resources yourself since I am not the one in building your game.

You should put an AlignOrientation somewhere in your aiming model, and an attachment on the part you want to move. Make sure to read the comments too.

The reason I would recommend this method over AngularVelocity is because:

  1. If you want something to face a certain direction, you should always use a gyro/AlignOrientation. AngularVelocities/Torques are better used for making something turn at a certain speed or similar.

  2. As I said, AlignOrientations are the direct and undeprecated successor of BodyGyros.