Call Of Duty zombie mystery box script

I’m making a zombie game like call of duty and I am adding the ‘Mystery Box’. Which is where a random weapon appears when the box is open. I want it so that when the First Person Controller goes to the box it says ‘Press X to Use’ and when you go away it disappears. When you do, the lid vanishes and the weapon appear. And you can take it, when you do it reappears and shows the Message again. Like Call Of Duty Zombies. Thankyou

-Kickasskane Productions

There is a lot of questions there.

  • Making the box appear, Instantiate a prefab.
  • The message when the player is close, GUI and a trigger.
  • The input, well, Input.GetKeyUp
  • The vanishing, while(box.renderer.color.a > 0 ) a-= etc, inside a coroutine, with a fitting shader.
  • The random Gun, an array of prefabs, and Random.Range.