-- You don't need to touch any of this

local cameraType = camera.CameraType
camera.CameraType = Enum.CameraType.Scriptable

local aimGui

if config.GunsEnabled.Value then
	aimGui = plane.AimPart.GUI:Clone()
	aimGui.Parent = player.PlayerGui
	aimGui.Enabled = true
	aimGui.Adornee = plane.AimPart
	
	if plane:FindFirstChild("Guns") then
		for _, gun in pairs(plane.Guns:GetChildren()) do
			gun.ChildAdded:connect(function(bullet)
				if bullet.Name == "Bullet" then
					bullet.CFrame = gun.Muzzle.CFrame
				end
			end)
		end
	end
end

local rs = game:GetService("RunService").RenderStepped

local mobileGui = script.MobileGui
local sliding = false

local thumb1, thumb2 = Vector2.new(), Vector2.new()
local x, y = 0, 0
local speed = 0

if userInputService.TouchEnabled then
	userInputService.ModalEnabled = true
	mobileGui.Parent = player.PlayerGui
	mobileGui.Throttle.Slider.MouseButton1Down:connect(function()
		sliding = true
		local mu
		mu = userInputService.TouchEnded:connect(function()
			sliding = false
			mu:disconnect()
		end)
		while sliding do
			rs:wait()
			local mouseY = mouse.Y - mobileGui.Throttle.AbsolutePosition.Y
			local s = math.min(math.max(mouseY / mobileGui.Throttle.AbsoluteSize.Y, 0), 1)
			speed = (1 - s) * config.Speed.Value
			mobileGui.Throttle.Slider.Position = UDim2.new(0, -10, s, -35)
		end
	end)
else
	mobileGui:Destroy()
end

local bodyGyro = Instance.new("BodyGyro", body)
bodyGyro.D = 30
bodyGyro.P = 300
bodyGyro.MaxTorque = Vector3.new()

local bodyVelocity = Instance.new("BodyVelocity", body)
bodyVelocity.P = math.huge
bodyVelocity.MaxForce = Vector3.new()
