I’m trying to use Motor6Ds already placed in a character model to rotate an NPC to follow a players movement. I’ve successfully gotten this testing script to follow myself(Protracted) around the map. When its facing in one direction. If I rotate the NPC any other way it doesn’t work. I’ve uploaded two videos to show the working version and the non working version from when I rotate the NPC.
Here is what I have so far
local rig = game.ReplicatedStorage.yes
rig.Parent = workspace
while game:GetService("RunService").Stepped:Wait() do
local lookAt = CFrame.new(rig.HumanoidRootPart.Position, workspace:WaitForChild("Protracted").UpperTorso.Position) - rig.HumanoidRootPart.Position
rig.UpperTorso.Waist.Transform = rig.UpperTorso.Waist.Transform:ToObjectSpace(rig.UpperTorso.Waist.Transform * lookAt)
print(rig.UpperTorso.Waist.Transform:ToObjectSpace(rig.UpperTorso.Waist.Transform * lookAt))
end
You notice how the shoulder points toward me on one
And the torso on the other