Module 7 · In Studio · challenge 1 of 2 in this lesson

offer returns ok only for an available ad outside a drill, with no double round held and under the session cap, and names the first rule that fails otherwise

A test in Studio grades it and prints a pass code.

Open

Level 3, Professional

Challenge

Start from the m14-ship tag in the game repo and fill in challenges/work/ad_reward.luau. Run it in Play with game.ServerScriptService.RunGameTests:Invoke("ads", "ads-reward-rules"). The written solution is challenges/solutions/ads.md.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("ads", "ads-reward-rules") in the server command bar. Copy the pass code from Output.

Done means

  • offer returns ok only for an available ad outside a drill, with no double round held and under the session cap, and names the first rule that fails otherwise
  • grant routes the Coin Pack and Double Round by product id, grants a purchase id once, refuses unknown and 0 ids, and keeps the newest 50 ids
  • transactionType marks ad receipts as RewardedAd and everything else as IAP
  • multiplier doubles the Scrap Rush multiplier and never passes the cap; startRound spends one held round
  • challenges/ads.luau prints TEST PASS for all 21 checks

The Course Runner prints this code when the test passes.