system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do they measure the weight of planets and how far away from Earth they are?

I don't know how much my dog weighs and these guys can figure out how dense stars are and shit that we can't even see. For the distance my guess is they use the speed of light. I'm sure they figured out the sun was 96mil miles from Earth based on the fact it takes light 8 minutes to reach Earth from the Sun.. But what  about the others?
gpt
If we know the mass of the star it orbits then it's an easy calculation based on a few observations of the planet.  A planet MUST be orbiting its sun at a speed that matches its mass in order to actually stay in orbit (any slower and it would fall out of orbit and any faster and it would escape).  All we need is the radius of the orbit around its sun and the period of that rotation (how long it takes to do a single run-around)