Hello, Im trying to make a script so that my seat can fly as if its an air plane, the issue is, whenever Im trying to enable the linear velocity, it never gets enabled.
I tried debugging and the output also showed that it was always disabled for some reason.
local Seat = script.Parent
local lineVel = Seat:WaitForChild("LinearVelocity")
local EnabledVal = lineVel.Enabled
while true do
task.wait()
print(Seat.Throttle)
print(Seat.Steer)
if EnabledVal == false then
print("EnableValue is false")
end
if EnabledVal == true then
print("EnableValue is true")
end
if Seat.Throttle == 1 then
lineVel.Enabled = true
lineVel.VectorVelocity = Vector3.new(0,0,20)
elseif Seat.Throttle == 0 then
lineVel.Enabled = false
end
if Seat.Throttle == -1 then
lineVel.Enabled = true
lineVel.VectorVelocity = Vector3.new(0,0,-20)
elseif Seat.Throttle == 0 then
lineVel.Enabled = false
end
end
local Seat = script.Parent
local lineVel = Seat:WaitForChild("LinearVelocity")
while true do
task.wait()
print(Seat.Throttle)
print(Seat.Steer)
if lineVel.Enabled == false then
print("lineVel is false")
end
if lineVel.Enabled == true then
print("lineVel is true")
end
if Seat.Throttle == 1 then
lineVel.Enabled = true
lineVel.VectorVelocity = Vector3.new(0,0,20)
elseif Seat.Throttle == 0 then
lineVel.Enabled = false
end
if Seat.Throttle == -1 then
lineVel.Enabled = true
lineVel.VectorVelocity = Vector3.new(0,0,-20)
elseif Seat.Throttle == 0 then
lineVel.Enabled = false
end
end
I’m not too sure. It’s fine but it spins when you go forwards.
local Seat = script.Parent
local lineVel = Seat:WaitForChild("LinearVelocity")
while true do
task.wait()
local EnabledVal = lineVel.Enabled
if Seat.Throttle == 1 then
lineVel.VectorVelocity = Vector3.new(0,0,-20)
elseif Seat.Throttle == -1 then
lineVel.VectorVelocity = Vector3.new(0,0,20)
elseif Seat.Throttle == 0 then
lineVel.VectorVelocity = Vector3.new(0,0,0)
end
end