Help with making a mysterybox code

So I am making an fps game and want the player to be able to buy items from a mystery box-like power-ups but I have no idea how to make it so that when the player is in front of the box that if a key is pressed an animation will play
(the box opening) and it will randomly select one of 4 models to enable and float out. Could someone plz help me I have no idea where to start

@Connor_Briggs To make you get one of the random models you can use this (i put some parts where you have to edit):

var random = Math.random(); // random goes through 0-1 so multiply that by 100 to get the accurate percentage
var box = "";
if(random <= 0.5 /*55%*/){
  //Give Common box
  box = "C";
}else if(random <= 0.25 /*35%*/){
  // Give Uncommon box
  box = "UC";
}else if(random <= 0.1 /*10%*/){
  // Give Rare Box
  box = "R";
}else if(random <= 0.001 /*0.01%*/){
  // Give Mythical box
  box = "M";
}

this.app.root.children.forEach((node) => {
  if(node.name = box) {
    node.enabled = true;
    // use the tweening library... 
    node.tween(node.getPosition()).to(/*Designated position goes here*/,1.0,/*Easing of choice*/).start();
  }
});

Okie thanks i’ll try that out

So what will i have to put in Var box = “?”;

Never mind i got it to work