Module 1 · In Studio · challenge 3 of 3 in this lesson
src/server/init.server.luau sets workspace attribute PlaytestMode to Server while RunService:IsServer() is true
A test in Studio grades it and prints a pass code.
Open
Level 3, Professional
Challenge
Mark the server during Play. For grading, add the lines to src/server/init.server.luau on m14-ship, straight after the WorldLook.start() line, which runs on every path (the file calls DataService.start() twice, once for the Lobby and once for the Yard, so do not use those). Put the RunService local next to the other service locals at the top. Sync, press Play rather than Run, and execute this in the server command bar:
game.ServerScriptService.RunGameTests:Invoke("playtesting")
It prints TEST PASS playtesting_mode. On the stock game it prints TEST FAIL playtesting_mode, and in Run mode TEST FAIL playtesting_player.
- Start from
- The game at milestone m03 (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 rungame.ServerScriptService.RunGameTests:Invoke("playtesting")in the server command bar. Copy the pass code from Output.
Done means
- src/server/init.server.luau sets workspace attribute PlaytestMode to Server while RunService:IsServer() is true
- The lines come before DataService.start()
- The check passes in Play and fails in Run mode