if key=="\100"and(faster==false and(slower==false and(Spd_keep==true and on==true)))then local P=plane.Engine:findFirstChild("\083\112\101\101\100")faster=true while faster do if P.Value<minspeed or P.Value>maxv then return end if P.Value==maxv then faster=false end P.Value=P.Value+1 wait()end elseif key=="\097"and(faster==false and(on==true and Spd_keep==true))then if on==false or plane.Engine:findFirstChild("\083\112\101\101\100")==nil then return end if slower==false and faster==false then local P=plane.Engine:findFirstChild("\083\112\101\101\100")slower=true while slower do if P.Value>=minspeed then P.Value=P.Value-1 elseif P.Value<minspeed then P.Value=minspeed slower=false end wait()end end end if key=="\115"and(planedebounce==false and on==true)then local P=plane.Engine:findFirstChild("\086\101\114\116\105\099\097\108\083\112\101\101\100")if P==nil then return end downer=true uper=false while downer do if P.Value==-20 then downer=false break end if downer==false then break end P.Value=P.Value-1 wait(.1)end end if key=="\119"and(planedebounce==false and on==true)then local P=plane.Engine:findFirstChild("\086\101\114\116\105\099\097\108\083\112\101\101\100")if P==nil then return end uper=true downer=false while uper==true do if uper==false then break end if P.Value>=20 then uper=false end P.Value=P.Value+1 wait(.1)end end if string.byte(key)==23 and on then local P=plane.Engine local N=P.Speed if N.Value<0 then while N.Value~=0 do N.Value=N.Value+1 wait(.1)end elseif N.Value>0 then while N.Value~=0 do N.Value=N.Value-1 wait(.1)end elseif N.Value==0 then N.Value=0 return end end
-------------------Speed Controls ( Up/down/Forward/Backward)-------------------
if (key == "d") and (faster == false) and (slower == false) and (Spd_keep == true) and (on == true) then
	local val = plane.Engine:findFirstChild("Speed")
	faster = true
	while faster do
		if (val.Value < minspeed) or (val.Value > maxv) then
			return
		end
		if val.Value == maxv then
			faster = false
		end
		val.Value = val.Value + 1
		wait()
	end
elseif (key == "a") and (faster == false) and (on == true) and (Spd_keep == true) then
	if (on == false) or (plane.Engine:findFirstChild("Speed") == nil) then
		return
	end
	if (slower == false) and (faster == false) then
		local val = plane.Engine:findFirstChild("Speed")
		slower = true
		while slower do
			if val.Value >= minspeed then
				val.Value = val.Value - 1
			elseif val.Value < minspeed then
				val.Value = minspeed
				slower = false
			end
			wait()
		end
	end
end

--Below u can see 2 if's these are if the Vert_keep value is set to true
if (key == "s") and planedebounce == false and on == true then
	local val = plane.Engine:findFirstChild("VerticalSpeed")
	if val == nil then
		return
	end
	downer = true
	uper = false
	while downer do
		if val.Value == -20 then
			downer = false
			break
		end
		if downer == false then
			break
		end
		val.Value = val.Value - 1
		wait(0.1)
	end
end

if (key == "w") and planedebounce == false and on == true then
	local val = plane.Engine:findFirstChild("VerticalSpeed")
	if val == nil then
		return
	end
	uper = true
	downer = false
	while uper == true do
		if uper == false then
			break
		end
		if val.Value >= 20 then
			uper = false
		end
		val.Value = val.Value + 1

		wait(0.1)
	end
end

--[[	if(string.byte(key) == 20) and (on == true) then 
			local engine = plane.Engine
			local bg = engine.BodyGyro
				sideleft = true
				while sideleft do
				sideway = 20
				wait(.1)
			end
		end 
			
		if(string.byte(key) == 19) and (on == true) then 
			local engine = plane.Engine
			local bg = engine.BodyGyro
				sideright = true
				while sideright do
				sideway = -20
				wait(.1)
			end
		end 	]]
--

if (string.byte(key) == 23) and on then
	local engine = plane.Engine
	local spd = engine.Speed
	if spd.Value < 0 then
		while spd.Value ~= 0 do
			spd.Value = spd.Value + 1
			wait(0.1)
		end
	elseif spd.Value > 0 then
		while spd.Value ~= 0 do
			spd.Value = spd.Value - 1
			wait(0.1)
		end
	elseif spd.Value == 0 then
		spd.Value = 0
		return
	end
end
