How do you add a weapon swapping mechanic

Im making a 2d platformer game and Its supposed to have weapon swapping mechanics but I just cant figure out how to make them

Welcome to the community!
I think I have an example, let me see. :slight_smile:

Here is a quick example I made;

Use the spacebar to swap the weapon.