Is there a way to get the parent of a GameObject in a script?

there is 2 ways

1# use transform.parent for the direct parent above

2# use transform.root witch us the very most top parent of the tree

hope this helps!

note: i am a bit rusty on scripting to this might not be right...