Module 2 · In Studio · challenge 3 of 3 in this lesson
challenges/oop_work.luau defines Cooldown.new(gap), cooldown:ready(now) and cooldown:use(now)
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 write a reusable Cooldown class. You edit only challenges/oop_work.luau; the solution is challenges/solutions/oop.md in the game repo.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("oop")in the server command bar. Copy the pass code from Output.
Done means
- challenges/oop_work.luau defines Cooldown.new(gap), cooldown:ready(now) and cooldown:use(now)
- Methods live on Cooldown and are shared through the metatable
- use returns true and records the time only when ready; two cooldowns never share state
- The Course Runner prints TEST PASS for every oop check and a pass code