I’m trying to create a flight script but something isn’t working out well.
First off, I’m using a BodyGyro to orient the Player towards where they want to go, which isn’t an issue right?
Well, I want the player’s head to face where they want to fly to, but the player’s body is facing the position.
Script so far:
local HumanoidRootPart = game.Players.LocalPlayer.Character.HumanoidRootPart
local VectorForce = Instance.new("VectorForce")
local BodyGyro = Instance.new("BodyGyro")
local RS = game:GetService("RunService")
local Mouse = game.Players.LocalPlayer:GetMouse()
BodyGyro.Parent = HumanoidRootPart
BodyGyro.MaxTorque = Vector3.new(400000,400000,400000)
RS.RenderStepped:Connect(function()
BodyGyro.CFrame = CFrame.lookAt(HumanoidRootPart.Position ,Mouse.Hit.Position)
--HumanoidRootPart.CFrame = HumanoidRootPart.CFrame * CFrame.Angles(math.rad(90),0, 0)
end)
What I want is for the top of the player’s head to be pointed in the direction of the mouse. I just don’t know how to accomplish this with Body Gyro.