Getting the direction of an object from another, then reversing it

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    im trying to make a rig look away from the player at all times

  2. What is the issue? Include screenshots / videos if possible!
    i cant get it too work, ive been at it for hours, things i try normally jsut end up with it spinning or completely wrong orientation

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    ive searched and searched, been at this for hours.
    ive tried several things, like reversing the Y, all the values, negative cframe lookat, etc

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local fake = script.Me:Clone()
fake.Parent = workspace
local run = game:GetService("RunService")
local HRP = char:WaitForChild("HumanoidRootPart")::Part
task.wait(1)

run.RenderStepped:Connect(function(delta)
	local dir = (fake.HumanoidRootPart.Position - HRP.Position).Unit
	local OpDir = (HRP.Position - fake.HumanoidRootPart.Position).Unit 
	--neither of these worked
	
	
	local x,y,z = CFrame.new(fake.HumanoidRootPart.Position,HRP.Position):ToEulerAnglesXYZ()
	fake.HumanoidRootPart.AlignOrientation.CFrame = CFrame.new(fake.HumanoidRootPart.Position) * CFrame.fromEulerAnglesXYZ(x,y,z)
end)

–local script, “Me” is a normal rig

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

try this inside renderstepped instead of the 2 lines that start with “local x,y,z”

local fakeHRP = fake.HumanoidRootPart
fakeHRP.CFrame = CFrame.new(fakeHRP.Position, fakeHRP.Position + dir)

alot simipler then expected, it it works, thank you!