Incorrect BodyVelocity behavior across PC to Mobile

I’ve been having issues with my Fly script, Descending does not work on mobile. It works completely fine on PC. The user slides and holds the down arrow to start descending, in the output you can see it prints “Descend” with the correct value. However the user keeps flying up, but “Ascend” works completely fine.

-- Set the flying speed(works)
Speed = (WingsControls.FlyingStatus == "Ascend" or WingsControls.FlyingStatus == "Descend") and WingsControls.FlyingSpeed or WingsControls.FlyingStatus == "Halt" and 16 or 0

-- Set the Y axis for the BV(Descend doesn't work on mobile)
Y = WingsControls.FlyingStatus == "Ascend" and 1 or WingsControls.FlyingStatus == "Descend" and -1 or WingsControls.FlyingStatus == "Halt" and 0 or 1

if Vector3.new(MoveVector.X, Y, MoveVector.Z) ~= Vector3.new(0, Y, 0) or WingsControls.FlyingStatus ~= "Halt" then
	BodyVelocity.Velocity = CFrame.new(Character.HumanoidRootPart.Position, Character.HumanoidRootPart.CFrame * CFrame.new(MoveVector.X, Y, MoveVector.Z).p).lookVector * (not Wings.FlightBoost and Speed or Speed * BoostMulitplyer)
elseif WingsControls.FlyingStatus == "Halt" then 
	BodyVelocity.Velocity = Vector3.new(0, 0, 0)
end
1 Like

Would you mind creating a bare bones reproduction of the bug that does not include the flight or game code?

4 Likes

While reviewing my code to make a stand-alone repro, I ended up finding my issue:

.lookVector * (not Wings.FlightBoost and Speed or Speed * BoostMulitplyer)

there is an issue right here with the lookVector, if changed to

.lookVector * 25

it will work fine.
Sorry for wasting your time.

2 Likes