Draft preview · this lesson is still being technically validated. Browser experiments and reference material remain available; trusted completion is enabled after publication.
Place server and client scripts deliberately
v2 · Activity 1 of 0 · script-locations · execution-context · 28 min Requires Roblox Studio
Chapter outline
A Script can use RunContext Server or Client. A LocalScript runs on the client in supported locations; a LocalScript placed in ReplicatedStorage does not run simply because it is visible there.
This exercise uses an explicit server Script in ServerScriptService and a LocalScript in StarterPlayerScripts. The latter is copied into each player’s PlayerScripts.
Your task
Add both files below. The server prints Server ready and true; each client prints Client ready and its own player name.
Interface: Complete the documented Studio hierarchy and self-check the behavior outside the browser.
| Input | Expected |
|---|
Syntax in this activity
New syntax: script-locations, execution-context
Earlier ideas used here
- instances
- properties
- services
Self-check rubric
- The server prints once per server session.
- Each client prints its own name.
- Move the LocalScript to ReplicatedStorage temporarily; observe that this placement does not run it. Restore the correct location.
Your explanation is a self-check. Exact wording is not automatically graded.
Self-checked Studio exercise. A saved checklist records your own review; no uploaded place file or screenshot is executed here.
Build this hierarchy
ServerScriptService
ContextServer (Script, RunContext=Server)
StarterPlayer
StarterPlayerScripts
ContextClient (LocalScript)- Create the two script types in the exact locations.
- Use Studio Test with one server and two clients.
ServerScriptService/ContextServer.server.luau
Server entry point; set RunContext Server.
local RunService = game:GetService("RunService")
print("Server ready", RunService:IsServer())StarterPlayer/StarterPlayerScripts/ContextClient.client.luau
LocalScript runs independently on each client.
local Players = game:GetService("Players")
print("Client ready", Players.LocalPlayer.Name)Expected output
- Server Output: Server ready true.
- Each client Output: Client ready followed by that client’s player name.
Studio assessment checklist
Multiplayer tests
- Run one server and two clients and compare the three Output views.
Troubleshooting and production considerations
LocalPlayer is nil on the server. Put that code in the client file.
Set the server Script RunContext explicitly; do not infer it from a filename.
This is a bounded learning lab. It has not been executed in an approved Roblox Studio environment by this website.
A checked checklist records your own review, not automated project competence or a community verification.
Add both files below. The server prints Server ready and true; each client prints Client ready and its own player name.
Reset starter
Replace this code with the starter? Download your draft to keep a copy.
Code
Studio source fileEdit and run these files in Roblox Studio. This browser has no Roblox services, physics, or replication.
Your output will appear here.
Sign in with RoCreators to save private progress across devices. Community verification is separate.