I'm not exactly 100% sure what you're asking, but I think I figured it out.
First of all however, you shouldn't be using the characters torso, as that will kill them instantly. You should instead be using the HumanoidRootPart, which is basically like a torso, but it won't kill the player if it disconnects from the body.
Now, for the code, all you really need to do is multiply the CFrame you're using by an Angle, rotating the character 90 degrees (pi radians). It is as simple as this:
CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
So now, applying this to your code, you just need to do the same exact thing:
Character.HumanoidRootPart.CFrame = CFrame.new(Character.Torso.Position,Vector3.new(Mouse.Hit.p.x,Character.Torso.Position.y,Mouse.Hit.p.z)) * CFrame.Angles(0,math.rad(90),0)
And there you go! It should work now.
Now, I'm not sure whether you'll need this to get it working, I assume you already know how, but just in case, here's the code I tested it with:
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
repeat wait() until plr.Character
local Character = plr.Character
repeat wait() until Character.HumanoidRootPart
while wait() do
Character.HumanoidRootPart.CFrame = CFrame.new(Character.Torso.Position,Vector3.new(Mouse.Hit.p.x,Character.Torso.Position.y,Mouse.Hit.p.z)) * CFrame.Angles(0,math.rad(90),0)
end
So yes, I have tested this myself, and it works how I think you want it to. If not, or if you have any further problems/questions, please leave a comment below and I'll see what I can do. Hope I helped!
1 comment
I don't understand