I’m trying to make a airplane move, Whenever i try it in studio it simply doesn’t move. I don’t get any errors so I’m pretty confused
heres the code
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
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 front_speed <= max_speed and seat.Throttle == 1 then
front_speed += acceleration
task.wait(0.5)
end
if front_speed >= 100 and seat.Throttle == 0 then
front_speed -= deceleration
task.wait(0.5)
elseif front_speed >= 1 and seat.Throttle == 0 then
front_speed -= wind_speed
task.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
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-(front_speed/2))
end
if seat.Position.Y + seat.Size.Y/2 > max_height then
script.LinearVelocity.VectorVelocity = Vector3.new(0,falling_speed,-front_speed)
end
end
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
local wind_speed = 2.5
local seatY = seat.Position.Y
while task.wait() do
script.AngularVelocity.AngularVelocity = Vector3.new(0,-1 * seat.Steer,0)
print("Works")
seat.Attachment.Orientation = Vector3.new(-seat.Orientation.X,0,0)
if front_speed <= max_speed and seat.Throttle == 1 then
print("Works")
front_speed += acceleration
task.wait(0.5)
end
if front_speed >= 100 and seat.Throttle == 0 then
print("Works1")
front_speed -= deceleration
task.wait(0.5)
elseif front_speed >= 1 and seat.Throttle == 0 then
print("Works2")
front_speed -= wind_speed
task.wait(0.2)
end
if front_speed >= takeoff_speed then
if seat.Throttle == 1 then
print("Works3")
script.LinearVelocity.VectorVelocity = Vector3.new(0,up_speed,-front_speed)
end
if seat.Throttle == -1 then
print("Works4")
script.LinearVelocity.VectorVelocity = Vector3.new(0,-up_speed,-front_speed)
end
if seat.Throttle == 0 then
print("Works5")
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-front_speed)
end
else
if seat.Throttle == 1 then
print("works6")
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-front_speed)
end
if seat.Throttle == -1 then
print("works7")
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-front_speed)
end
if seat.Throttle == 0 then
print("works8")
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
print("works9")
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
print("works10")
script.LinearVelocity.VectorVelocity = Vector3.new(0,0,-(front_speed/2))
end
if seat.Position.Y + seat.Size.Y/2 > max_height then
print("works11")
script.LinearVelocity.VectorVelocity = Vector3.new(0,falling_speed,-front_speed)
end
end
Is any part of your model anchored? Does it move if you disable the script and manually change the VectorVelocity (through the command line or the properties window)?
It works perfectly when i take a look at the properties, everything is “moving” and the velocity is increasing, However it’s not being reflected on the screen