M4/M16 style AEG's typically have a selector switch that is held into place by a plastic disc on the inside of the receiver that holds the switch in place, accessing it requires removing the gearbox from the lower receiver body.. This disc is mounted off center and has a "D" shaped recess for attachment to the inside of the switch. They are held together with a very small screw. Because of the design it's not likely to just fall off since the gearbox is in the way and it takes more turns of the screw then the body will allow the switch to turn, keeping the screw from loosening. Unfortunately since it fell off in play it's likely that either the disc inside busted or the threading in the selector fouled, causing the screw to no longer grip the switch... unless you forgot to install the screw after taking it apart (I'm guessing this isnt the case as you'd know how to reattach it if you took it apart). It it fairly straight forward to reattach but if any of the three pieces (switch, disc, or screw) are missing or damaged you'll likely need a new switch kit that is a few bucks or if it's a missing screw you MIGHT be able to find one with the same thread pitch and length at Ace Hardware or similar, but remember it's a very small screw that needs to stay flush with the side of that disc.