Skip to content
Tutorials Center
My learning

Topics

Lesson 7 of 37 ยท Studio and Basics

Services and Containers

"Learn Roblox's services and containers: Workspace, Players, ReplicatedStorage, ServerStorage, ServerScriptService and the Starter folders, who can see what, and GetService."

At the top of the Explorer tree sit services. A service is a special instance that provides a feature of the engine: the 3D world, the list of players, lighting, saving data, tweening, and more. Some services are also containers that hold your own objects. Knowing which container to use decides whether your code runs on the server or on the client, and whether players can see or steal your assets.

Getting a service

The built-in global game is the root of everything. The proper way to get a service is game:GetService:

LUA
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

print(#Players:GetPlayers(), "players in the game")

GetService always returns the service, creating it if needed, and keeps working even if a service is renamed. A few have shortcut globals: workspace for Workspace, and game itself. Convention is to write service variables in PascalCase near the top of the script.

The main containers

Service Who can see its contents What it is for
Workspace Server and every client The visible 3D world, physics happen here
Players Server and clients One entry per connected player, with their character
Lighting Server and clients Sky, brightness, fog, time of day
ReplicatedStorage Server and every client Shared things: modules, remote events, templates
ServerScriptService Server only Scripts and modules that must stay private
ServerStorage Server only Assets the server clones into the world later
ReplicatedFirst Client, loaded first Loading screens
StarterGui Copied to each player's PlayerGui Screens, menus and HUD
StarterPack Copied to each player's Backpack Tools that players start with
StarterPlayer Copied to each player Contains StarterPlayerScripts and StarterCharacterScripts
SoundService Both Global audio

Server only really means it. A client cannot see anything in ServerScriptService or ServerStorage, so secrets and game rules stay safe there. Whatever you put in ReplicatedStorage or Workspace is sent to every player, who can inspect it, so never put secrets or reward tables there.

Where does it go?

ServerScriptService Private server scripts.
ServerStorage Private assets to clone later.
ReplicatedStorage Shared modules and remotes.
Workspace The visible, simulated world.

Server only means players cannot see it.

1 / 2

The Starter folders

The Starter containers are templates. When a player joins, Roblox copies their contents into that player's own objects:

  • StarterGui becomes Players.<name>.PlayerGui.
  • StarterPack becomes Players.<name>.Backpack.
  • StarterPlayerScripts becomes Players.<name>.PlayerScripts.
  • StarterCharacterScripts is copied into the character each time it spawns.

So editing PlayerGui at runtime changes only one player's copy. To change what every future player gets, change the Starter template. This is a very common beginner confusion: to make a button appear for all players, put it in StarterGui; to change it for one player during the game, change their PlayerGui.

Players and characters

Players holds one Player object for each connected player. A Player is not the visible avatar; the visible body is the Character, a Model in Workspace that contains a Humanoid and body parts such as HumanoidRootPart.

LUA
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	print(player.Name, "joined")
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		print(player.Name, "spawned with", humanoid.Health, "health")
	end)
end)

PlayerAdded and CharacterAdded are events; the :Connect call registers a function that runs each time the event fires. Events are covered in depth later; here, notice the order: a player joins first, their character spawns afterwards, and may spawn again after each death.

Choosing the right container

  • A door the player walks through: Workspace, scripted by a server Script.
  • A sword players start with: StarterPack.
  • A module of shared constants: ReplicatedStorage.
  • Boss enemy templates the server clones on a timer: ServerStorage.
  • The code that awards coins: ServerScriptService.
  • The coin counter on screen: StarterGui with a LocalScript.

Stand-in: who can see what

This JavaScript stand-in models visibility. Each container lists whether the server and the clients can read it. The function answers "can this side see that object?" Change a container name and see what changes.

JS Stand-in: container visibility (JavaScript)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stand-in: Starter templates copy to each player

JS Stand-in: StarterGui is copied per player (JavaScript)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Ana's change stays with Ana. Change the template before anyone joins and everyone starts with the new value.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Where should server-only scripts that players must never see live?

    ServerScriptService contents are never sent to clients.
  2. 2. What is StarterGui?

    StarterGui is copied into each PlayerGui, so editing the copy affects only that player.
  3. 3. Why is ReplicatedStorage a bad place for a secret reward table?

    ReplicatedStorage is shared with all clients, so anything in it can be inspected by players.
  4. 4. How do you get the Players service?

    game:GetService is the standard, safe way to get any service.

Summary

  • Services are special instances at the top of the tree; get them with game:GetService.
  • Workspace and ReplicatedStorage are visible to everyone; ServerScriptService and ServerStorage are server-only.
  • Starter containers are templates copied to each player or character.
  • A Player is the account; the Character is the avatar model.

Next: Luau Variables and Types