Takeoff and Landing with Tweens


I am currently working on a larger project, but part of it is a small system to have planes take off and land on a runway automatically. I’m not going to get into the details of the project, but I basically need AI planes that can do things themselves.

I have a small demo of a Cessna 172 Taking Off and Landing. This whole system is entirely built with Tweens. I personally believe it looks pretty good, let me know what you think!


TakeoffDemo - YouTube

LandingDemo - YouTube

What do you think of it?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

How much adaptable your system is? As of, do you have a coded runway template that has all the features coded in so that it automatically picks up planes for landing - so that it is ready to go without any or much user intervention after copying it?

There currently isn’t a “system”, I’m planning on using OOP to handle the planes and their actions. I want to get it to the point where you can run a function such as:


From there the script could find the runway and land the plane on it.

Currently though, I just have a simple script with a table of the points, which it iterates through to land:

local TPoints = workspace.TweenPoints
local C172 = workspace["Cessna 172"]:Clone()
local TS = game:GetService("TweenService")
C172.Parent = workspace
C172.Name = "Plane2"

--Table of tweenparts
local PointTable = {
	{TPoints.Landing.MapEnterPoint, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 100},
	{TPoints.Landing.TouchDownPoint, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 100},
	{TPoints.Landing.FrontWheelDownPoint, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 100},
	{TPoints.Landing.SlowPoint, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 60, true},
	{TPoints.Landing.TurnPoint, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 60},
	{TPoints.Landing.StopPoint, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 10}
--Set the plane to the first point:


for i,v in pairs(PointTable) do
	local Dist = (C172.PrimaryPart.Position - v[1].Position).magnitude
	local angleChange = (C172.PrimaryPart.Orientation - v[1].Orientation).magnitude
	local Time = ((angleChange + Dist) / v[4])
	local Ti = TweenInfo.new(Time, v[2], v[3], 0, false, 0)
	local T = TS:Create(C172.GroundPart, Ti,{CFrame = v[1].CFrame})
	if v[5] then
		--Tween is going to be cancelled early
		wait(Time - 2)
		--Tween is going to play all the way through