Skip to content

Instantly share code, notes, and snippets.

@UltiRequiem
Created April 24, 2025 17:13
Show Gist options
  • Save UltiRequiem/4065c799e76af961a773f692f24c6284 to your computer and use it in GitHub Desktop.
Save UltiRequiem/4065c799e76af961a773f692f24c6284 to your computer and use it in GitHub Desktop.
I teach roblox to kids
local seat = script.Parent
local max_speed = seat.MaxSpeed
local front_speed = 0
local acceleration = 5
local deceleration = 3.5
local up_speed = 5
local max_height = 100
local takeoff_speed = 75
local falling_speed = -9.807 * 4.5 --so that it does not stay long in the air if it does not have the speed to fall, change it if you like
local wind_speed = 2.5
local seatY = seat.Position.Y
while task.wait() do
script.AngularVelocity.AngularVelocity = Vector3.new(0,-1 * seat.Steer,0)
seat.Attachment.Orientation = Vector3.new(-seat.Orientation.X,0,0)
--if seat.Occupant ~= nil then
--print(front_speed)
--end
if front_speed <= max_speed and seat.Throttle == 1 then--acceleration
front_speed += acceleration
wait(0.5)--acceleration, change this and the aircraft will accelerate faster.
end
if front_speed >= 100 and seat.Throttle == 0 then--deceleration
front_speed -= deceleration
wait(0.5)--deceleration, change this so that it suffers a higher deceleration if you don't press W
elseif front_speed >= 1 and seat.Throttle == 0 then
front_speed -= wind_speed
wait(0.2)
end
if front_speed >= takeoff_speed then
if seat.Throttle == 1 then
script.LinearVelocity.VectorVelocity = Vector3.new(0,up_speed,-front_speed)
end
if seat.Throttle == -1 then
script.LinearVelocity.VectorVelocity = Vector3.new(0,-up_speed,-front_speed)
end
if seat.Throttle == 0 then
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-front_speed)
end
else
if seat.Throttle == 1 then
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-front_speed)
end
if seat.Throttle == -1 then
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-front_speed)
end
if seat.Throttle == 0 then
if front_speed == 0 and seat.Position.Y - seat.Size.Y/2 >= 4 then
script.LinearVelocity.VectorVelocity = Vector3.new(0,falling_speed,-front_speed)
else
script.LinearVelocity.VectorVelocity = Vector3.new(0,-up_speed,-front_speed)
end
end
end
if seat.Throttle ~= 1 and math.round(seat.position.Y - seat.Size.Y/2) <= seatY then--On floor
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-(front_speed/2))
end
if seat.Position.Y + seat.Size.Y/2 > max_height then --Max height
script.LinearVelocity.VectorVelocity = Vector3.new(0,falling_speed,-front_speed)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment