I'm working a script to were the player constantly faces in the direction of an NPC everything is working well except for the fact that instead of the character facing towards the NPC, it faces away from it. Ive tried making the X value negative to see if it changes anything but then the character just spins in circles. I'm not sure how i'm supposed to correct this?
local plr = game.Players.LocalPlayer local char = plr["Character"] local pos1 = char.HumanoidRootPart local pos2 = game.Workspace.Dummy.HumanoidRootPart local RunService = game:GetService("RunService") local BG = Instance.new("BodyGyro", char.HumanoidRootPart) BG.D = 150 BG.MaxTorque = Vector3.new(0, 400000, 0) BG.P = 25000 local function onRenderStep() BG.CFrame = CFrame.new(pos2.Position, pos1.Position) end RunService.RenderStepped:Connect(onRenderStep)
change
BG.CFrame = CFrame.new(pos2.Position, pos1.Position)
into
BG.CFrame = CFrame.new(pos1.Position, pos2.Position)