How can you use onmousedown() if there is a rigidbody in the hierarchy?

If a gameobject is in the same hierarchy as a rigidbody, it won’t work. How can I make the onmousedown object a child to that rigidbody but still have the onmousedown function work?

Just figured out a way you can solve this is by adding a rigidbody component to the object you attached the onmousedown script to.