How to replace current equipped item in inventory?

I’m currently making a shooter that have purchasable weapons on a wall. Is there a way that when you buy an item on the wall it replaces the current equipped weapon in your equipped slot?

you could make an array of the items in an inventory and if its like type gun remove it and then grant them the new item. I don’t think its possible for you to know what item they have out.

I wish epic would expand on the agent class or at least have some built in methods but ig its wtvr

you can use a conditional button to detect what weapon they are holding, and then remove it with an item remover

Yes! I’ve tried this before, but I’m looking more for removing the current equipped item and not just any item in my inventory

the conditional button has an option as of a couple of updates ago that detects whether you’re actually holding the item.

Oh wow I think this it it! Thank you so much! I didn’t realize this update haha. But does that mean that if the key item is a smg and I am equipping an smg it will remove my smg and replace it? What if I’m holding a M4 and the key item is a smg? It won’t remove the M4 though

Well, what you’re going to want to do is detect the item they’re holding with the conditional button, remove that item with an item remover, and then activate an item granter to grant the desired replacement weapon. How they are choosing that weapon sort of dictates how you set that up. If you can be more specific I can probably offer a solution.

Sure. Basically what I want to do is what Call of Duty Zombies does. If you have inventory space and you buy (item grant) a weapon, it goes into your empty inventory slot. But if your inventory space is already full but you buy a weapon, if you are currently equipping a gun that is used in inventory space 1, that gun gets replaced by the new gun you just bought.