Module 15 · In your browser · challenge 3 of 3 in this lesson
validatePayouts rejects any negative percentage, any gameSplit sum over 1.0, or any groupSplit sum over 1.0 (returns nil and an error reason)
A code cell with the real Luau runner grades it. No Studio needed.
Open
Level 3, Professional
Challenge
Implement validatePayouts(grossRobux, gameSplits, groupSplits, minReservePct) in the cell below to audit group splits before saving them in Creator Hub.
- Start from
- The Luau cell below (runs in your browser)
- Check it here
- Run the code cell; the challenge completes when it passes. No Studio needed.
Done means
- validatePayouts rejects any negative percentage, any gameSplit sum over 1.0, or any groupSplit sum over 1.0 (returns nil and an error reason)
- Treats grossRobux as gross first-party pass and product sales, applies the example 30% fee once (net = floor(grossRobux * 0.70)), then game splits, then group splits on the remainder
- Rejects any configuration that leaves less than minReservePct (the studio's own policy, e.g. 0.15) of net Robux in the group treasury
- Returns a payouts table (member -> Robux) and treasury Robux when valid