How can I change the projectile I'm shooting, but switch back to the original projectile?

So I’m currently using the FPS template that unreal gives you and I started with the c++ version and not the blueprinting. In my game, I want to be able to shoot a projectile, but say if I get a powerup, I want to change my projectile(bullet) to a different projectile(rocket) but then still return back to bullets after a certain amount of time. Does anyone know of a good way to go about swapping just the projectiles the character shoots? Blueprint or code works fine. Thanks

i would mostly recommend for people who dont have a lot of knowledge in c++ and are still learning to start with a blueprint template. obviously u can add c++ classes in it if you want something c++ related. u can even if need be, create a utility/ essential class like player controller do what u want in the class and then just create a blueprint using that c++ class.
C++ Can be extended by blueprints and thats a awesome thing to have. Thanks to Epic for that.

When you collect the powerup, use an on component begin overlap event to set a bool (e.g. “bHasPowerup?”) in the player to true. When you attack, check if the bool is true. If true, spawn a rocket, if else spawn a bullet. You can use a delay node to switch back to no powerup (start the delay in the powerup collectable after setting the powerup variable to true.