How to make On Clicked on object event work with right clicking

So when I use the on clicked event with an actor, it will work with left click, but does nothing with right clicking. I essentially want to detect if the player right clicks on the object if someone has a solution thanks!

you can create an action (project setting / inputs) for your right click.
on your action event in your player controler, add a line trace under mouse cursor, it will fin your actor, on right click, and it s up to you to trigger something in your actor (using a BP interface for exemple)

Unfortunately, I tried this, but it doesn’t work. What I’m trying to do is spawn another actor when you right click the first actor. However strangely, if I spawn the actor from event begin play, it spawns fine, but if I try to spawn it after a right click event, it doesnt spawn at all. And I know the right click works as I tested with a print string and branch to ensure it is right clicking, and it does print a string, it just doesn’t spawn the actor for some reason when right clicking

expose’s solution does work. I’ve done this before.