Make a part face another part using the new AlignOrientation

hello so i got into the “new body movers” recently and they mad confusing so i need help yea

this code makes the rootpart’s cframe be the same as the target’s rootpart cframe but i want the rootpart to constantly face the target rootpart like look at it, this just gets confusing so any help is appreciated thx

	local grabAttachmentCharacter = Instance.new("Attachment")
	grabAttachmentCharacter.Name = "AssasinsGrabAttachmentOrigin"..plr.Name
	grabAttachmentCharacter.Parent = rootpart
	

	local grabAttachmentTarget = Instance.new("Attachment")
	grabAttachmentTarget.Name = "AssasinsGrabAttachmentTarget"..plr.Name
	grabAttachmentTarget.Parent = target.HumanoidRootPart 

	local alignOrientation = Instance.new("AlignOrientation")
	alignOrientation.MaxTorque	 = 500000
	alignOrientation.Attachment0 = grabAttachmentCharacter
	alignOrientation.Attachment1 = grabAttachmentTarget
	alignOrientation.Responsiveness = 10000
	alignOrientation.Parent = rootpart
3 Likes

You want a part facing another part or facing a player?

Something Like this?
Making an NPC look at your character - Help and Feedback / Scripting Support - DevForum | Roblox

Assuming you just want a smooth rotation, couldn’t you just tween the “rootpart” to face the “target.HumanoidRootPart”?

Something like:

game:GetService("TweenService"):Create(rootpart, TweenInfo.new(1), {CFrame = CFrame.lookAt(rootpart.Position, target.HumanoidRootPart.Position}):Play()

Also, not sure if this might help. Here’s 2 parts facing each other with the “alignOrientation”

PartsFaceEachOther.rbxm (4.2 KB)

nono i just need to use these cuz they respect physics, its like a, make the player face another player then make the player travel to another player, using align position later just the align orientation is a problem atm

they break if you rotate one part tho

Aligin orientation has CFrame property

local AO = Instance.new("AlignOrientation",part)
AO.Attachment0 = PartAtt
AO.Mode = Enum.OrientationAlignmentMode.OneAttachment
AO.MaxTorque = math.huge
AO.CFrame = CFrame.new(part.Position,part2.Position)
AO.Responsiveness = 200

Here is a test place:
aliginorientation.rbxl (33.7 KB)

9 Likes

does the job very well thank you