Draft preview · this lesson is still being technically validated. Browser experiments and reference material remain available; trusted completion is enabled after publication.
v2 · Activity 4 of 5 · script-locations · execution-context · 28 min Requires Roblox Studio
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.
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 |
|---|
local RunService = game:GetService("RunService")
print("Server?", RunService:IsServer())IsServer reports the execution context rather than the name or location you hoped to use.
New syntax: script-locations, execution-context
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.
ServerScriptService
ContextServer (Script, RunContext=Server)
StarterPlayer
StarterPlayerScripts
ContextClient (LocalScript)Server entry point; set RunContext Server.
local RunService = game:GetService("RunService")
print("Server ready", RunService:IsServer())LocalScript runs independently on each client.
local Players = game:GetService("Players")
print("Client ready", Players.LocalPlayer.Name)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.
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.
Use server and client Output views to observe context. Seeing the same message twice is not evidence of a shared authoritative state.
Replace this code with the starter? Download your draft to keep a copy.
Edit 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.