How to get UI Element that called function.
you’d probably do a lot better have a simple script attached to each “menu” which has a variable you can populate storing the menu you moved from, you can then use that variable in the generic function to move “back”.
Without seeing how you are doing the transitions between menus it’s a little difficult to advise how to set that up though.