how to make a Equipment Script

how would i go along making a equipment script so if you press on a object with a tag helmet than add to the helmet slot and add to our player? i have made a little something and stated with enum but i just got lost here it is:

enum ArmourPiece { Helmet, Platebody, Platelegs, Cape, WeaponSlot, ShieldSlot }
var Equipment = ArmourPiece.Helmet;

function AddToEquipment() {
gameObject.tag = "Helmet";

gameObject.tag = "Platebody";

gameObject.tag = "Platelegs";

gameObject.tag = "Cape";

gameObject.tag = "WeaponSlot";

gameObject.tag = "ShieldSlot";


i have a inventory script but it has a bunch of errors but here it is :

var EmptySlot : Texture2D;
class InventoryItem
var ItemTexture : Texture;
function Start () {
GUI.Box(Rect(20,20,50,125), "Inventory" );
function Empty()
GUI.Button(Rect (10, 10, 10, 10), "Empty");
GUI.DrawTexture(Rect, EmptySlot);
function Loot(){
GUI.Button(Rect(20,20,50,125), ItemTexture);
GUI.DrawTexture(Rect, ItemTexture);

and here it the inventoryitem script:

static var ItemTexture : Texture2D;
function OnMouseDown(){
function Loot(){
GUI.DrawTexture(Rect(10,10,60,60), ItemTexture, ScaleMode.ScaleToFit, true);

thank you to anyone who helps :slight_smile:

The function AddToEquipment is just changing the tag multiple times. Your inventory script is only going to throw an error because you call GUI stuff outside of OnGUI. It’s only display anyway, buttons are not used for anything there. Finally, the OnMouseDown function is going to display a texture for a single frame, you probably won’t even notice it.

So, the idea of using enums seems good enough, but you still have a lot of work to do. You should use transforms to positions each objects on your character (one for the head, one for the heand, etc).