Common globals available to Scripts and LocalScripts.
These are not classes. Documented here until they get a final home.
Events use `Event:Connect`. See Event and Connection.
Overview
Functions
- wait(seconds: number?) deprecated
- print(...)
- warn(...)
- require(moduleScript: ModuleScript) : any
- Instance.new(className: string) : Instance
Values
- workspace : Workspace
- Workspace : Workspace
- Shared : table
- script : Script or LocalScript
- player : Player?
- task : Task
- RunModule : RunModule
- InputModule : InputModule
- TweenModule : TweenModule
- RaycastModule : RaycastModule
- PlayerMovementModule : PlayerMovementModule
- CameraModule : CameraModule
- PartTaggingModule : PartTaggingModule
- MarketplaceModule : MarketplaceModule
- MessageModule : MessageModule
- StatsModule : StatsModule
- TeamsModule : TeamsModule
API
wait
wait(seconds: number?) : void deprecated
Yields the current script coroutine.
Prefer `task.wait`, which works inside event listeners too.
No longer recommended for use.
print(...) : void
Prints to the server log from Scripts, or the client log from LocalScripts.
Labeled with the Script name when possible. See Errors.
warn
warn(...) : void
Logs a non-fatal warning with the same Script labeling as print.
require
require(moduleScript: ModuleScript) : any
Loads a ModuleScript and returns its return value.
Results are cached per ModuleScript.
Instance.new
Instance.new(className: string) : Instance
Creates a new Instance.
| className | Result |
|---|---|
"Part" | Part |
"Brick" | Part deprecated alias of "Part" |
"Model" | Model |
"Connector" | Connector |
"Tool" | Tool |
"ModuleScript" | ModuleScript |
On LocalScripts, only "Part" / "Brick" are supported. Those Parts have `.Client` set, are not replicated, and can be destroyed locally.
On Scripts, "Model", "Connector", "Tool", and "ModuleScript" are also supported.
local p = Instance.new("Part")
p.Name = "MyBrick"
p.Parent = workspace
workspace
workspace : Workspace
The place root.
Workspace is an alias of workspace.
Shared
Shared : table
Explicit shared environment for all Scripts in this place. Same table as bare globals written from Scripts.
LocalScripts do not use Shared.
script
script : Script or LocalScript
The currently running script.
See Script and LocalScript for Parent and events.
player
player : Player?
On LocalScripts: the local player.
On Scripts: set during Touched for legacy handlers that call player:Kill() with no argument. Prefer the player argument from the event instead.
Modules
Globals such as task, RunModule, InputModule, TweenModule, RaycastModule, PlayerMovementModule, CameraModule, PartTaggingModule, MarketplaceModule, MessageModule, StatsModule, and TeamsModule.
See Modules.
