Module 3 · In Studio · challenge 2 of 2 in this lesson
ShopService.purchase records workspace:GetServerTimeNow() per player before the item branches
A test in Studio grades it and prints a pass code.
Open
Level 3, Professional
Challenge
Rate-limit the shop on the server. The written solution, including the edit to the suite's shop_shield check, is challenges/solutions/security.md in the game repo.
- Start from
- The game at milestone m06 (download)
- Grade it
- To grade work from an earlier milestone, apply your challenge changes to a checkout based on
m14-ship, which includes the Course Runner. In Studio, press Play, then runrequire(game.ReplicatedStorage.GameTests.RunChallenge)("security")in the client command bar. Copy the pass code from Output.
Done means
- ShopService.purchase records workspace:GetServerTimeNow() per player before the item branches
- A second purchase right after the first is denied with the Feedback text Too fast (self-check, the test cannot see it: the gap is 0.5 seconds)
- Self-check, the test cannot see it: the shop_shield check in tests/init.luau waits out the new gap and still expects the shield to be bought
- The Course Runner prints TEST PASS security_shop_rate and a pass code