Module 2 · In your browser · challenge 2 of 3 in this lesson

The first call to onSwing() returns true

A code cell with the real Luau runner grades it. No Studio needed.

Open

Level 2, Builder

Challenge

Implement onSwing() in the cell below using time(). Passing all five assertions completes this challenge.

Start from
The Run cell below
Check it here
Run the code cell; the challenge completes when it passes. No Studio needed.

Done means

  • The first call to onSwing() returns true
  • Calls sooner than 0.4 s later return false without resetting the timer
  • A call at or after 0.4 s returns true and restarts the cooldown
Luau with roblox-lite (not Roblox)
Ctrl Enter runs the cell. Checked by tests