My game has this fly system that works by spawning a part where the player's mouse is and having a rocket propulsion bodymover propel the player towards their mouse (which is where the part is).
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local runService = game:GetService('RunService')
local target = nil
local rocketprop = nil
local function onCharacterAdded(character)
local torso = character:WaitForChild('Torso') -- the torse where the force will be
target = Instance.new('Part', game.Workspace) -- creating the target
target.Size = Vector3.new(0.2,0.2,0.2)
target.CanCollide = true
target.Anchored = true
target.Transparency = 0.5
target.Name = player.Name .. "'s target"
rocketprop = Instance.new("RocketPropulsion", torso) -- creating the force
rocketprop.Target = target -- setting the target to be the target part I created
rocketprop.TargetRadius = 1
rocketprop.CartoonFactor = 1
rocketprop.MaxSpeed = 50
rocketprop.MaxTorque = Vector3.new(400000,400000,100000)
rocketprop:fire()
end
local function isnan(x) return x ~= x end -- to check if the mouse is in an invalid position
local function onRenderStep()
rocketprop.TargetOffset = rocketprop.Target.Position -- make the rocket propulsion go towards the target
if target then
local mousepos = mouse.Hit.p
if not (isnan(mousepos.X) or isnan(mousepos.Y) or isnan(mousepos.Z)) then
target.Position = mousepos -- make the target stay where the mouse is
end
end
end
while not player.Character do wait() end
onCharacterAdded(player.Character)
player.CharacterAdded:connect(onCharacterAdded)
runService:BindToRenderStep('TrackMouse', Enum.RenderPriority.Input.Value, onRenderStep)
This works and allows the player to fly (albeit in a very unreliable way) but when the player flies it just looks like this is flying standing up with his hands in the air. The position I want it to look like is something like this: https://probaway.files.wordpress.com/2010/08/superman-jet.jpg?w=529 How do I orient the player's body so that it points at the target as well as flying towards it?

3 comments
You should use bodygyros instead of rocketprops.
Doesn't body gyro only rotate the character? Not, move it in a direction?
BodyGyro rotates objects toward a position. It doesn't mean you can't have more than one force acting on an object