Help with making a plane go up

I’m trying to make a plane go up using the scroll wheel and a bodygyro. I just don’t know how to rotate a plane to go up, any solutions?

Code:

uis.InputChanged:Connect(function(input) -- Elevator Pitch
	if control == "Keyboard" then
		if input.UserInputType == Enum.UserInputType.MouseWheel then
			if input.Position.Z > 0 then
				--up
				local Main = Plane:FindFirstChild("Main")
				if Main then
					Main.Gyro.maxTorque = Vector3.new(0,math.huge,0)
					Main.Gyro.CFrame = CFrame.Angles(0,0,math.rad(10)) 
                    -- stuck atm, this doesn't work
				end
			else
				--down
				local Main = Plane:FindFirstChild("Main")
				if Main then
					Main.Gyro.maxTorque = Vector3.new(0,math.huge,0)
					Main.Gyro.CFrame = CFrame.Angles(0,0,math.rad(-10))                  
                    -- stuck atm, this doesn't work
				end
			end
		end
	end
end)

in the first line replace uis.InputChanged to uis.InputBegan

1 Like

It doesn’t work with InputBegan and only works with InputChanged.

I’m basically just trying to scroll for aircraft pitching.

Please, I actually need help here.

What exactly isn’t working? Did you set the network owner of the plane to the player who is controlling it? Setting the MaxTorque X and Z to 0 could also be an issue.

Nevermind I got that to work (it uses X to control up and down)

Main.Gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
Main.Gyro.CFrame = Main.Gyro.CFrame * CFrame.Angles(math.rad(5),0,0) -- up