Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

UpperTorso not facing the part?

Asked by 3 years ago

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.

0
You're making the uppertorso of your character face the humanoidrootpart of the same character User#30567 0 — 3y
0
I'm not? hrp stands for humanoidRootPart (the character's) and target stands for, well, target. TheOnlineItalian213 99 — 3y
0
Did you check the PrimaryPart of the target wasn't nil? andyc889 0 — 3y

Answer this question