My Helicopter Does not Stay Still

Hi there. I have a helicopter that I made which is programmed to stay still when I let go of the key “E” or “Q” (Up and Down). But when I do this my helicopter still keeps on going up or down.

This is some code:

if input == "Q" then
	script.Parent.Parent.Steer.BodyForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.Parent.Steer:GetMass() / 2, 0)
	script.Parent.Parent.Forward.BodyForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.Parent.Forward:GetMass() / 2, 0)
end
if input == "E" then
	script.Parent.Parent.Steer.BodyForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.Parent.Steer:GetMass() * 2, 0)
	script.Parent.Parent.Forward.BodyForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.Parent.Forward:GetMass() * 2, 0)
end
if input == "Stop" then
	print("hi")
	script.Parent.Parent.Steer.BodyForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.Parent.Steer:GetMass(), 0)
	script.Parent.Parent.Forward.BodyForce.Force = Vector3.new(0, workspace.Gravity * script.Parent.Parent.Forward:GetMass(), 0)
end

All help is appreciated.

If you think you know the issue, please try to resolve it before making a thread. Or at least mention what you think the issue might be.

This is all fine and good, but the code segment you gave us requires however you receive the input is being handled properly, which it’s clearly not if it’s not working (is your print statement even running?). Can you show us the code where you actually determine what the input variable is?

You have to count the Player mass, I mean
Character mass
All parts mass. not only the chopper

I have all parts of the character set to massless.

The print statement is running. The input is just what key I press on the client. There a while wait(0.1) loop that is in the client and will break when you press another key.

local UIS = game:GetService("UserInputService")

local up = false
local down = false
local event = game:GetService(“ReplicatedStorage”):WaitForChild(“MoveHeli2”)

UIS.InputBegan:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.E then
up = true
while wait(0.1) do
if up == true then
event:FireServer(“E”)
else
break
end
end
end
if input.KeyCode == Enum.KeyCode.Q then
down = true
while wait(0.1) do
if down == true then
event:FireServer(“Q”)
else
break
end
end
end
end
end)

UIS.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.E then
up = false
event:FireServer(“Stop”)
end
if input.KeyCode == Enum.KeyCode.Q then
down = false
event:FireServer(“Stop”)
end
end
end)

My helicopter uses vector forces and body forces.