Attaching an entity to a compound entity

var Kuddy = pc.createScript('kuddy');
Kuddy.attributes.add("compoundEntity", {type: "entity"});
Kuddy.attributes.add("attachment", {type:"entity"});

Kuddy.prototype.update = function() {
var com = this.compoundEntity.getPosition();
var ey = com.y + 0.861;   
var ex = com.x + 4.211;
    var compy = this.compoundEntity.getRotation().y;
    var compx = this.compoundEntity.getRotation().x;
    var compz = this.compoundEntity.getRotation().z;
  
this.attachment.setPosition(ex, ey, com.z);
    this.attachment.setRotation(compx, compy, compz);
    
};
Kuddy.prototype.initialize = function() {

};

That might have a chance of working, and do you know you can make variables inside variables, like.

var vary = "wow";
var varx = 30;
var thisVariable = varx + vary;
var all = alert(thisVariable);
if(//whatever condition you want){
all;
}

i figured it out already thanks for your help though

@jus.co_ding_me_23 maybe you could help here Gamepad help please