a gun accessory includes a main body having an upper surface having two sides , a first side wall and a second side wall extending upwardly from each of the two sides , first and second slide members provided on the first and second side walls , respectively , and a first locating hole provided adjacent the first side wall . the accessory also includes a first locating bar pivotably coupled to the first locating hole and having a first baffle and a first press plate , and a first elastic element provided between the first press plate and the main body to pivot the first press plate with respect to the main body , and in turn drive the first baffle to protrude above the upper surface of the main body .