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:
:land("06")
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:
C172:SetPrimaryPartCFrame(PointTable[1][1].CFrame)
wait(10)
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])
print(Time)
local Ti = TweenInfo.new(Time, v[2], v[3], 0, false, 0)
local T = TS:Create(C172.GroundPart, Ti,{CFrame = v[1].CFrame})
T:Play()
if v[5] then
--Tween is going to be cancelled early
wait(Time - 2)
T:Cancel()
else
--Tween is going to play all the way through
wait(Time)
end
end
``