If a card with beam me up is put into your graveyard during your turn, you can cast it if it's legal to do so before any other player can take any actions.

Artwork
Loading artwork…
Scotty, Miracle Worker
Star Trek · #79 · EN
Nonfoil—Foil—
Card rules
During your main phase, each card in your graveyard has beam me up. The beam me up cost is equal to that spell's mana cost. Scotty can't be beamed up to cast a spell this way. (Only instant and sorcery spells can be cast this way. You may cast a card from your graveyard for its beam me up cost if you also return another creature you control to its owner's hand. Then exile that spell.)
2/3
Mythic · Illustrated by Sam Kennedy
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Future Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pioneer Legal
Standard Legal
Standard Brawl Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
PreDH Not Legal
Premodern Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
A spell cast using beam me up will always be exiled afterward, whether it resolves, is countered, or leaves the stack in some other way.
You can cast a spell using beam me up even if it was somehow put into your graveyard without having been cast.
You must still follow any timing restrictions and permissions, including those based on the card's type. For instance, you can cast a sorcery using beam me up only when you could normally cast a sorcery.
To determine the total cost of a spell, start with the mana cost or alternative cost (such as a beam me up cost) you're paying, add any cost increases, then apply any cost reductions. The mana value of the spell is determined only by its mana cost, no matter what the total cost to cast the spell was.
"Beam me up [cost]" means "You may cast this card from your graveyard by paying [cost] and returning a creature you control to its owner's hand rather than paying its mana cost" and "If the beam me up cost was paid, exile this card instead of putting it anywhere else any time it would leave the stack."
Scotty can't be returned to your hand to pay the beam me up cost of spells cast with the beam me up ability granted by his ability. He can be returned to your hand to pay the beam me up cost of spells that are cast using their own beam me up abilities.