Can anyone help me with this? How would I make it so that when the rig gets to the desired location, they face in the same direction as the part? How would I go about scripting that?
Character:PivotTo(Character:GetPivot().Position) * CFrame.Angles(part.Orientation))
here is an example, you’d ofc ignore y angle of the orientation
This code actually results in two errors, but it’s an easy fix.
local part1 = workspace.Part1
local part2 = workspace.Part2
local pos = part1:GetPivot().Position
local rot = part2:GetPivot().Rotation
part1:PivotTo(rot + pos)
what is part 2? I’m using a rig so I’m confused on what you’re doing.
part1 is character
part2 is the part whose rotation you are copying
I’m assuming you want the character to look only on the Y axis so they can continue walking normally. Let me know if that isn’t the case! I also provided two different scripts because I wasn’t sure exactly what you mean by “facing in the same direction”.
-- Look at the part in Y axis
local part: BasePart
local character: Model
local pivot = character:GetPivot()
local look = CFrame.new(pivot.Position, part.Position)
local x, _, z = pivot:ToOrientation()
local _, y, _ = look:ToOrientation()
character:PivotTo(CFrame.new(pivot.Position) * CFrame.Angles(x, y, z))
-- Same rotation on Y axis as part
local part: BasePart
local character: Model
local pivot = character:GetPivot()
local x, _, z = pivot:ToOrientation()
local _, y, _ = part.CFrame:ToOrientation()
character:PivotTo(CFrame.new(pivot.Position) * CFrame.Angles(x, y, z))