If seat position is in Y coordinate range the vehicle will flip when you press F

Hey guys.

Trying to make this script flip the vehicle when the player presses F, but only if the vehicle is on the ground. The way I’m checking this is setting a range Y coordinate. The whole script works, but this new line breaks it. This is the error I get:
image

Does anyone know what the solution is?

Why don’t you check the orentation of the veicle to check?
This will only work if the seat position is -15 which uh, anyway.
what’s seat defined on?

The vehicle is a plane, so if I use orientation, this means that players can just press Y to turn the engine off in the air and then press F, allowing to them to hover completely still for a moment. In a dogfight this is unfair because if another player is chasing them the person chasing will just sail past them, and now the person who flipped midair now is chasing the other player.

So how can i specify a range between 0 -15 on the y axis?
edit: maybe an orientation check could go with this too. like seat.Position.Y == 0-15 and seat.Orientation == -90 - 180

well but if you do seat.Position.Y will only work if the plane is on Y Position of -15.

What you can do, is what I said, and check if seat.Velocity.Magnitude is low, then flip it

but couldn’t I just do:
if seat.Position.Y >= 0 and seat.Position.Y <= 15 then

The range isn’t the problem; this is, and I’m not sure why:
6307ecc8694ff9cf52d9c1921d3e13bcf3d9e178
image
local seat = script.Parent.Parent.Parent

If you are parenting the Gui to the Player’s PlayerGui - that will not be the location of the seat. You will have to get the seat from workspace - not relative from the Gui’s location.

So in order to do that, you will need to identify the plane is the player’s plane.