How to make it so that when I press the G button, will my character throw away the weapon he is holding?

This is the basic idea. I had to pull out stuff that wasn’t relevant so I’ve never run this exact event. It should work though.