roblox-core
When to Use
Use this skill when the task is primarily about core Roblox runtime structure and everyday gameplay scripting:
- Choosing whether logic belongs on the client, server, or both.
- Deciding where
Script, LocalScript, and ModuleScript instances should live.
- Organizing code across
ServerScriptService, ServerStorage, ReplicatedStorage, ReplicatedFirst, StarterPlayer, StarterGui, and Workspace.
- Using services, module reuse, attributes, and bindables inside normal gameplay code.
- Working with common Studio scripting workflows like playtesting, Explorer layout,
WaitForChild(), and Output-driven debugging.
- Implementing straightforward input, camera, raycasting, collision, and
CFrame behavior as part of ordinary experience scripting.
Do not use this skill when the task is mainly about:
- Exhaustive engine API lookup or class-by-class reference browsing.
- Cross-boundary remote design, advanced remote security, or server-authority architecture.
- Persistence, memory stores, messaging, Open Cloud, OAuth, or external automation.
Decision Rules
- Use this skill if the main question is structural: where code lives, what runs where, what replicates, or how to organize reusable Roblox logic.
- Use this skill for foundational engine patterns that appear in most experiences: services, modules, attributes, bindables, basic input, workspace access, collisions, raycasts, camera, and
CFrame.
- If the task centers on
RemoteEvent, RemoteFunction, trust boundaries, request validation, or multiplayer message design, hand off to roblox-networking.
- If the task is mainly "which API/member do I call" across a large Roblox surface area, hand off to
roblox-api.
- If the task centers on saving, loading, quotas, versioning, cross-server state, or ephemeral shared state, hand off to
roblox-data.
- If the task involves Open Cloud, web APIs, credentials, OAuth, or external tooling automation, hand off to
roblox-cloud or roblox-oauth.
- If a request mixes core structure with out-of-scope systems, answer only the foundational Roblox portion and explicitly exclude the rest.
- If unsure, prefer the narrower interpretation and omit material that would overlap networking, data, cloud, or API-reference skills.
Instructions
- Start by identifying the runtime side for each responsibility:
- Server for authoritative world state, spawning, rule enforcement, and shared simulation.
- Client for player-local input, camera, moment-to-moment presentation, and local feedback.
- Shared modules only when both sides need the same code or constants.
- Place code in containers that match replication behavior:
ServerScriptService for server-only scripts and modules.
ServerStorage for server-only assets or modules that do not need to replicate.
ReplicatedStorage for shared modules and replicated assets.
ReplicatedFirst only for earliest client startup work.
StarterPlayerScripts, StarterCharacterScripts, StarterGui, and StarterPack for client behavior copied into each player.
- Prefer explicit script intent:
- Use
LocalScript or Script with RunContext = Client for client code.
- Use
Script with RunContext = Server or normal server placement for server code.
- Use
ModuleScript for reusable logic and configuration.
- Retrieve services once near the top of a script with
game:GetService() and keep names aligned with service names.
- Use
WaitForChild() when accessing replicated objects from the client unless the load order is guaranteed by the container being used.
- Treat
ModuleScript return values as cached per Luau environment:
- Require once per script and reuse the returned table or function.
- Avoid circular requires.
- Keep shared modules side-agnostic unless the module is intentionally server-only or client-only.
- Use attributes for lightweight per-instance state and configuration that should live on the instance itself.
- Use bindables only for communication on the same side of the client-server boundary. Prefer module-owned bindables when they simplify a local event API.
- For input and camera code, keep implementation client-side and adapt to the player's active input mode rather than assuming desktop-only controls.
- For workspace scripting:
- Read and write object state through clear references.
- Use raycasts for intentional spatial queries.
- Use collision groups or part properties for collision behavior.
- Use
CFrame operations when orientation and relative transforms matter.
- Keep examples and guidance at the foundational level. Do not drift into persistence, advanced networking security, or exhaustive reference lookups.
Using References
- Open
references/scripting-overview.md for the basic Roblox scripting workflow in Studio and the standard service-module-function-event script shape.
- Open
references/client-server-runtime.md to reason about authority, replication, edit versus runtime data models, and what each side can safely assume.
- Open
references/script-locations-and-script-types.md when deciding between Script, LocalScript, ModuleScript, run contexts, and container placement.
- Open
references/services.md for the core game:GetService() pattern and which container or gameplay services matter most in foundational code.
- Open
references/modulescripts-and-reuse-patterns.md for module caching, shared code placement, configuration modules, and encapsulation patterns.
- Open
references/attributes.md for per-instance state, replication-order cautions, and change-detection patterns.
- Open
references/bindable-events.md for same-side script communication, async events, sync callbacks, and argument-shape cautions.
- Open
references/input-overview.md for client-side input handling and adapting to preferred input type across devices.
- Open
references/workspace-basics-camera-raycasting-collisions-and-cframes.md for the most common world-facing runtime patterns.
Checklist
- Each responsibility is assigned to the correct runtime side.
- Script and module placement matches replication and visibility needs.
- Shared code is in
ModuleScript form instead of duplicated across scripts.
- Client code uses
WaitForChild() where replication order is uncertain.
- Services are retrieved once and reused.
- Attributes are used for lightweight instance state, not arbitrary module data.
- Bindables are only used on one side of the client-server boundary.
- Input and camera code stays client-side.
- Raycasts, collisions, and
CFrame operations are used intentionally for spatial logic.
- No advanced remote-security design is included.
- No persistence, Open Cloud, OAuth, or external API automation guidance is included.
- No exhaustive API catalog material is included.
Common Mistakes
- Putting server-only logic in
ReplicatedStorage or other replicated containers.
- Expecting a plain
Script to run everywhere without considering location or RunContext.
- Using
LocalScript where a shared ModuleScript should hold reusable logic.
- Assuming replicated objects already exist on the client and skipping
WaitForChild().
- Treating bindables as cross-network communication tools.
- Mutating a module return value without realizing the cached reference is reused within that environment.
- Using attributes for large structured data that belongs in a module or system object.
- Driving camera or input code from the server.
- Using
Touched for non-physical overlap logic that should be a raycast or explicit spatial query.
- Moving parts with raw position logic when relative transforms or facing direction require
CFrame.
Examples
Choose placement by responsibility
-- ServerScriptService/SpawnController
-- Spawns and manages shared world state on the server.
-- StarterPlayer/StarterPlayerScripts/InputController
-- Reads player input and drives local presentation on the client.
-- ReplicatedStorage/Shared/Constants
-- Shared module used by both sides.
local Constants = {
MaxHealth = 100,
RoundLength = 120,
}
return Constants
Use the standard script shape
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RoundConfig = require(ReplicatedStorage:WaitForChild("RoundConfig"))
local function onPlayerAdded(player)
print(player.Name, "joined; round length:", RoundConfig.RoundLength)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Keep client-only camera code local
local Workspace = game:GetService("Workspace")
local camera = Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.lookAt(Vector3.new(0, 10, 20), Vector3.new(0, 5, 0))
camera.Focus = CFrame.new(0, 5, 0)
Use attributes and bindables for local structure
local part = script.Parent
part:SetAttribute("Active", true)
local changed = Instance.new("BindableEvent")
changed.Event:Connect(function(state)
print("State changed:", state)
end)
changed:Fire(part:GetAttribute("Active"))
1---2name: roblox-core3description: Use for foundational Roblox experience development: deciding what runs on the client or server, where scripts and modules belong, how to structure reusable code, and how to handle everyday services, attributes, bindables, workspace objects, input, camera, raycasts, collisions, and CFrame-based gameplay scripting in Studio.4---56# roblox-core78## When to Use910Use this skill when the task is primarily about core Roblox runtime structure and everyday gameplay scripting:1112- Choosing whether logic belongs on the client, server, or both.13- Deciding where `Script`, `LocalScript`, and `ModuleScript` instances should live.14- Organizing code across `ServerScriptService`, `ServerStorage`, `ReplicatedStorage`, `ReplicatedFirst`, `StarterPlayer`, `StarterGui`, and `Workspace`.15- Using services, module reuse, attributes, and bindables inside normal gameplay code.16- Working with common Studio scripting workflows like playtesting, Explorer layout, `WaitForChild()`, and Output-driven debugging.17- Implementing straightforward input, camera, raycasting, collision, and `CFrame` behavior as part of ordinary experience scripting.1819Do not use this skill when the task is mainly about:2021- Exhaustive engine API lookup or class-by-class reference browsing.22- Cross-boundary remote design, advanced remote security, or server-authority architecture.23- Persistence, memory stores, messaging, Open Cloud, OAuth, or external automation.2425## Decision Rules2627- Use this skill if the main question is structural: where code lives, what runs where, what replicates, or how to organize reusable Roblox logic.28- Use this skill for foundational engine patterns that appear in most experiences: services, modules, attributes, bindables, basic input, workspace access, collisions, raycasts, camera, and `CFrame`.29- If the task centers on `RemoteEvent`, `RemoteFunction`, trust boundaries, request validation, or multiplayer message design, hand off to `roblox-networking`.30- If the task is mainly "which API/member do I call" across a large Roblox surface area, hand off to `roblox-api`.31- If the task centers on saving, loading, quotas, versioning, cross-server state, or ephemeral shared state, hand off to `roblox-data`.32- If the task involves Open Cloud, web APIs, credentials, OAuth, or external tooling automation, hand off to `roblox-cloud` or `roblox-oauth`.33- If a request mixes core structure with out-of-scope systems, answer only the foundational Roblox portion and explicitly exclude the rest.34- If unsure, prefer the narrower interpretation and omit material that would overlap networking, data, cloud, or API-reference skills.3536## Instructions37381. Start by identifying the runtime side for each responsibility:39 - Server for authoritative world state, spawning, rule enforcement, and shared simulation.40 - Client for player-local input, camera, moment-to-moment presentation, and local feedback.41 - Shared modules only when both sides need the same code or constants.422. Place code in containers that match replication behavior:43 - `ServerScriptService` for server-only scripts and modules.44 - `ServerStorage` for server-only assets or modules that do not need to replicate.45 - `ReplicatedStorage` for shared modules and replicated assets.46 - `ReplicatedFirst` only for earliest client startup work.47 - `StarterPlayerScripts`, `StarterCharacterScripts`, `StarterGui`, and `StarterPack` for client behavior copied into each player.483. Prefer explicit script intent:49 - Use `LocalScript` or `Script` with `RunContext = Client` for client code.50 - Use `Script` with `RunContext = Server` or normal server placement for server code.51 - Use `ModuleScript` for reusable logic and configuration.524. Retrieve services once near the top of a script with `game:GetService()` and keep names aligned with service names.535. Use `WaitForChild()` when accessing replicated objects from the client unless the load order is guaranteed by the container being used.546. Treat `ModuleScript` return values as cached per Luau environment:55 - Require once per script and reuse the returned table or function.56 - Avoid circular requires.57 - Keep shared modules side-agnostic unless the module is intentionally server-only or client-only.587. Use attributes for lightweight per-instance state and configuration that should live on the instance itself.598. Use bindables only for communication on the same side of the client-server boundary. Prefer module-owned bindables when they simplify a local event API.609. For input and camera code, keep implementation client-side and adapt to the player's active input mode rather than assuming desktop-only controls.6110. For workspace scripting:62 - Read and write object state through clear references.63 - Use raycasts for intentional spatial queries.64 - Use collision groups or part properties for collision behavior.65 - Use `CFrame` operations when orientation and relative transforms matter.6611. Keep examples and guidance at the foundational level. Do not drift into persistence, advanced networking security, or exhaustive reference lookups.6768## Using References6970- Open `references/scripting-overview.md` for the basic Roblox scripting workflow in Studio and the standard service-module-function-event script shape.71- Open `references/client-server-runtime.md` to reason about authority, replication, edit versus runtime data models, and what each side can safely assume.72- Open `references/script-locations-and-script-types.md` when deciding between `Script`, `LocalScript`, `ModuleScript`, run contexts, and container placement.73- Open `references/services.md` for the core `game:GetService()` pattern and which container or gameplay services matter most in foundational code.74- Open `references/modulescripts-and-reuse-patterns.md` for module caching, shared code placement, configuration modules, and encapsulation patterns.75- Open `references/attributes.md` for per-instance state, replication-order cautions, and change-detection patterns.76- Open `references/bindable-events.md` for same-side script communication, async events, sync callbacks, and argument-shape cautions.77- Open `references/input-overview.md` for client-side input handling and adapting to preferred input type across devices.78- Open `references/workspace-basics-camera-raycasting-collisions-and-cframes.md` for the most common world-facing runtime patterns.7980## Checklist8182- Each responsibility is assigned to the correct runtime side.83- Script and module placement matches replication and visibility needs.84- Shared code is in `ModuleScript` form instead of duplicated across scripts.85- Client code uses `WaitForChild()` where replication order is uncertain.86- Services are retrieved once and reused.87- Attributes are used for lightweight instance state, not arbitrary module data.88- Bindables are only used on one side of the client-server boundary.89- Input and camera code stays client-side.90- Raycasts, collisions, and `CFrame` operations are used intentionally for spatial logic.91- No advanced remote-security design is included.92- No persistence, Open Cloud, OAuth, or external API automation guidance is included.93- No exhaustive API catalog material is included.9495## Common Mistakes9697- Putting server-only logic in `ReplicatedStorage` or other replicated containers.98- Expecting a plain `Script` to run everywhere without considering location or `RunContext`.99- Using `LocalScript` where a shared `ModuleScript` should hold reusable logic.100- Assuming replicated objects already exist on the client and skipping `WaitForChild()`.101- Treating bindables as cross-network communication tools.102- Mutating a module return value without realizing the cached reference is reused within that environment.103- Using attributes for large structured data that belongs in a module or system object.104- Driving camera or input code from the server.105- Using `Touched` for non-physical overlap logic that should be a raycast or explicit spatial query.106- Moving parts with raw position logic when relative transforms or facing direction require `CFrame`.107108## Examples109110### Choose placement by responsibility111112```lua113-- ServerScriptService/SpawnController114-- Spawns and manages shared world state on the server.115```116117```lua118-- StarterPlayer/StarterPlayerScripts/InputController119-- Reads player input and drives local presentation on the client.120```121122```lua123-- ReplicatedStorage/Shared/Constants124-- Shared module used by both sides.125local Constants = {126 MaxHealth = 100,127 RoundLength = 120,128}129130return Constants131```132133### Use the standard script shape134135```lua136local Players = game:GetService("Players")137local ReplicatedStorage = game:GetService("ReplicatedStorage")138139local RoundConfig = require(ReplicatedStorage:WaitForChild("RoundConfig"))140141local function onPlayerAdded(player)142 print(player.Name, "joined; round length:", RoundConfig.RoundLength)143end144145Players.PlayerAdded:Connect(onPlayerAdded)146```147148### Keep client-only camera code local149150```lua151local Workspace = game:GetService("Workspace")152153local camera = Workspace.CurrentCamera154camera.CameraType = Enum.CameraType.Scriptable155camera.CFrame = CFrame.lookAt(Vector3.new(0, 10, 20), Vector3.new(0, 5, 0))156camera.Focus = CFrame.new(0, 5, 0)157```158159### Use attributes and bindables for local structure160161```lua162local part = script.Parent163part:SetAttribute("Active", true)164165local changed = Instance.new("BindableEvent")166changed.Event:Connect(function(state)167 print("State changed:", state)168end)169170changed:Fire(part:GetAttribute("Active"))171```