So, I'm trying to make the UpperTorso of my character face the humanoidRootPart of another player, only problem being i suck at math.
I honestly don't see what's wrong with this code If anyone could explain to me how to do it i would be really thankful.
while wait() do
local char = script.Parent
local hrp = char.HumanoidRootPart
local waist = char.UpperTorso.Waist
local space = math.atan2(hrp.Position.Y, target.PrimaryPart.Position.X)
print(space)
waist.C0 = waist.C0:Lerp(CFrame.fromEulerAnglesXYZ(0, math.rad(space), 0), 0.1)
end
As you can see, it assigns the cframe just fine, but it doesnt want to turn the UpperTorso? Please help if you can.

3 comments
You're making the uppertorso of your character face the humanoidrootpart of the same character
I'm not? hrp stands for humanoidRootPart (the character's) and target stands for, well, target.
Did you check the PrimaryPart of the target wasn't nil?