How can I lift the plane perfectly?

Hey there! I’m trying to make an airplane game, but since BodyMovers and these kind of stuffs got deprecated, I can’t get a working solution. I’ve been doing researching for hours but can’t get a result.
I tried using VectorForces for thrust and yaw. However this seems to not work with lifting, I mean, It works but very bad. Like even if I’m not moving, the plane can just go up.

I deleted lifting system from my plane, so please help me find a solution to perfectly lift the plane.

Heres the code:

local Plane = game.Workspace["Generic"]
local Body = Plane.Plane.Body.Body.PrimaryPart
local Source = Plane.Source
local Config = Plane.Configuration
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()


local Engine1 =  Body.ENGINE1F
local Engine2 = Body.ENGINE2F
local LeftRudder = Body.RudderPowerLF
local RightRudder = Body.RudderPowerRF
local Lift = Body.LIFTF
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")

local MotorAdd = 5000
local GroundStable = 5500
local AirBreakPower = 5500
local MinimumEnginePower = 30000


local TurnerPowerAdd = 5000
local TurnerPowerRemove = TurnerPowerAdd * 2
local TurnLimit = 100000

local Ychanger = 25000

local isFlying = false
local isEngineOn = true

-- Throtle Handle

local isHoldingW
local isHoldingS
local isHoldingA
local isHoldingD
local isHoldingUpArrow
local isHoldingDownArrow

UserInputService.InputBegan:Connect(function(input, gpe)
	if input.UserInputType ~= Enum.UserInputType.Keyboard then return end
	if input.KeyCode == Enum.KeyCode.W then
		isHoldingW = true
	end
	if input.KeyCode == Enum.KeyCode.S then
		isHoldingS = true
	end
	if input.KeyCode == Enum.KeyCode.A then
		isHoldingA = true
	end
	if input.KeyCode == Enum.KeyCode.D then
		isHoldingD = true
	end
	if input.KeyCode == Enum.KeyCode.Up then
		isHoldingUpArrow = true
	end
	if input.KeyCode == Enum.KeyCode.Down then
		isHoldingDownArrow = true
	end
	

	
end)
UserInputService.InputEnded:Connect(function(input, gpe)
	if input.KeyCode == Enum.KeyCode.W then
		isHoldingW = false
	end
	if input.KeyCode == Enum.KeyCode.S then
		isHoldingS = false
	end
	if input.KeyCode == Enum.KeyCode.A then
		isHoldingA = false
	end
	if input.KeyCode == Enum.KeyCode.D then
		isHoldingD = false
	end
	if input.KeyCode == Enum.KeyCode.Up then
		isHoldingUpArrow = false
	end
	if input.KeyCode == Enum.KeyCode.Down then
		isHoldingDownArrow = false
	end
end)


if isEngineOn then
	Engine1.Force = Vector3.new(MinimumEnginePower,0,0)
	Engine2.Force = Vector3.new(MinimumEnginePower,0,0)
end

while true do
	if isHoldingW then
			if Engine1.Force.X <= Config.MAX_FORCE.Value then
				Engine1.Force += Vector3.new(MotorAdd,0,0)
				Engine2.Force += Vector3.new(MotorAdd,0,0)
			end
	end
	if isHoldingS then
		if isFlying == false then
			if Engine1.Force.X >= MinimumEnginePower then
				Engine1.Force -= Vector3.new(GroundStable,0,0)
				Engine2.Force -= Vector3.new(GroundStable,0,0)
			end
		end
	end
	if isHoldingA then
		if LeftRudder.Force.X >= 0 and LeftRudder.Force.X <= (100000 - TurnerPowerAdd) then
			LeftRudder.Force += Vector3.new(TurnerPowerAdd,0,0)
		end 
	else
		if LeftRudder.Force.X >= (0 + TurnerPowerRemove) then
			LeftRudder.Force -= Vector3.new(TurnerPowerRemove,0,0)	
		end
	end
	if isHoldingD then
		if RightRudder.Force.X >= 0 and LeftRudder.Force.X <= (100000 - TurnerPowerAdd) then
			RightRudder.Force += Vector3.new(TurnerPowerAdd,0,0)
		end 
	else
		if RightRudder.Force.X >= (0 + TurnerPowerRemove) then
			RightRudder.Force -= Vector3.new(TurnerPowerRemove,0,0)	
		end
	end

	
	task.wait()
end

1 Like