ground weapon switch

hello guys would you give me a hand to solve this problem of mine?

i am using this code to drop and take weapons

I would like to find a solution to make sure that when the player is on top of a weapon he switches with the one on the ground, throwing the one he is holding one more forward

marked code is my draft but you don’t think it’s the correct solution

if i understand correctly then use the change z-order action