How Do We Weigh Stars?

How do we figure out how massive a star is if it lives lightyears away from us?

Checkout these cool gadgets...