last update: 01/03/2019parent: Object creation

Gun (weapon)

Create a prim with the shape you like (better a mesh with the shape of a gun or rifle), if you will use an already made one please remove any script may inside. Attach it to hand and fix the position. Deattach it and re-attach 'till you get  the best position.


Create a new script inside the weapon prim like the example below:


default {
  state_entry() {}  
  attach( key id ) {             
    if (id != NULL_KEY) {        
      llRequestPermissions(id, PERMISSION_TAKE_CONTROLS);
    else {     


  run_time_permissions(integer perm) {      
    if ( (perm & cPERMS) == cPERMS) {      
      llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);

  control(key id, integer level, integer edge) {      
    if ((~level & edge) & 0x40000000) {     


This example is the minimum needed, the one you will find in the eZombieKit use also animation and gunshot sound.

(you can find eZombieKit inworld at URI: