local function D(D)local K=plane.Propeller if D then K.Hinge.DesiredAngle=1e+100 else local D=math.random(0,10)K.Hinge.DesiredAngle=D K.Hinge.CurrentAngle=D end end seat.Changed:connect(function(K)if K=="\079\099\099\117\112\097\110\116"then local K=seat.Occupant if K then D(true)local n=game.Players:GetPlayerFromCharacter(K.Parent)if n then plane.Body:SetNetworkOwner(n)local D=script.LocalPlaneScript:Clone()D.Parent=n.PlayerGui D.Plane.Value=plane D.Disabled=false else shooting=false end else D(false)end end end)while true do if seat.Occupant and shooting then for D,K in pairs(plane.Guns:GetChildren())do if K:FindFirstChild("\077\117\122\122\108\101")then local D=Instance.new("\080\097\114\116")D.Parent=K D.Anchored=false D.CanCollide=false D.FormFactor=Enum.FormFactor.Custom D.Size=Vector3.new(.4,10,.4)D.BrickColor=BrickColor.new("\066\114\105\103\104\116 \121\101\108\108\111\119")D.Material=Enum.Material.Neon Instance.new("\067\121\108\105\110\100\101\114\077\101\115\104",D);(Instance.new("\066\111\100\121\070\111\114\099\101",D)).Force=Vector3.new(0,D:GetMass()*196.2,0)D.CFrame=K.Muzzle.CFrame D.Velocity=D.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))*2000 D:SetNetworkOwner(game.Players:GetPlayerFromCharacter(seat.Occupant.Parent))D.Touched:connect(function(K)if not K:IsDescendantOf(plane)and not K:IsDescendantOf(seat.Occupant.Parent)then local K=Instance.new("\069\120\112\108\111\115\105\111\110",game.Workspace)K.Position=D.Position K.BlastRadius=4 K.DestroyJointRadiusPercent=0 D:Destroy()end end)game.Debris:AddItem(D,1)end end end wait(.1)end

local function Engine(on)
	local prop = plane.Propeller
	
	if on then
		prop.Hinge.DesiredAngle = 1e100 -- Super huge number so the propeller doesn't stop spinning :D
	else
		local angle = math.random(0, 10)
		prop.Hinge.DesiredAngle = angle
		prop.Hinge.CurrentAngle = angle
	end
end

seat.Changed:connect(function(p)
	if p == "Occupant" then
		local occupant = seat.Occupant
		
		if occupant then
			Engine(true)
			local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
			if player then
				plane.Body:SetNetworkOwner(player)
				local localPlaneScript = script.LocalPlaneScript:Clone()
				localPlaneScript.Parent = player.PlayerGui
				localPlaneScript.Plane.Value = plane
				localPlaneScript.Disabled = false
			else
				shooting = false
			end
		else
			Engine(false)
		end
	end
end)

while true do
	if seat.Occupant and shooting then
		for _, gun in pairs(plane.Guns:GetChildren()) do
			if gun:FindFirstChild("Muzzle") then
				local bullet = Instance.new("Part")
				bullet.Parent = gun
				bullet.Anchored = false
				bullet.CanCollide = false
				bullet.FormFactor = Enum.FormFactor.Custom
				bullet.Size = Vector3.new(0.4, 10, 0.4)
				bullet.BrickColor = BrickColor.new("Bright yellow")
				bullet.Material = Enum.Material.Neon
				Instance.new("CylinderMesh", bullet)
				Instance.new("BodyForce", bullet).Force = Vector3.new(0, bullet:GetMass() * 196.2, 0)
				bullet.CFrame = gun.Muzzle.CFrame
				bullet.Velocity = bullet.CFrame:vectorToWorldSpace(Vector3.new(0, 1, 0)) * 2000
				bullet:SetNetworkOwner(game.Players:GetPlayerFromCharacter(seat.Occupant.Parent))
				
				bullet.Touched:connect(function(hit)
					if not hit:IsDescendantOf(plane) and not hit:IsDescendantOf(seat.Occupant.Parent) then
						local explosion = Instance.new("Explosion", game.Workspace)
						explosion.Position = bullet.Position
						explosion.BlastRadius = 4
						explosion.DestroyJointRadiusPercent = 0
						bullet:Destroy()
					end
				end)
				
				game.Debris:AddItem(bullet, 1)
			end
		end
	end
	wait(0.1)
end
