Moving scripts from the earlier API

Dialect replaced the earlier scripting API, and scripts written for it do not run. Most of the difference is updated names and a few design changes covered below.

API equivalents

EarlierDialect
Vector3.new(x, y, z)vec(x, y, z)
Color3.fromRGB(r, g, b)rgb(r, g, b)
Color3.new(r, g, b)vec(r, g, b) (0 to 1)
:Connect(fn), :On(fn):connect(fn)
:Once, :Wait, :Disconnect, :Off:once, :wait, :disconnect
task.wait(n), wait(n)sleep(n)
task.spawn(fn)scope:spawn(fn)
task.delay(n, fn), task.every(n, fn)scope:after(n, fn), scope:every(n, fn)
workspace.Doorworld.root:find("Door")
Players.PlayerAdded, Players.PlayerRemovingworld.joined, world.left
Players:GetPlayers()world:query { class = Player }:entities()
PlayerTouchedstepped_on
.Position, .Size, .Color, .Transparency, .Anchored, .Name, .Parent, .Healththe same names in lower case
.CanCollide.solid
.UserId.user_id
:FindFirstChild, :FindChild:find
:GetChildren():children()
:Teleport, :Kick, :Play, :Stop, :Destroylower case
(no directive)--!server for a Script, --!client for a LocalScript, --!module for a ModuleScript

Strings and comments are never changed.

Patterns to update

EarlierWhat to do
script.ParentA script is a file now, not something inside a part. Find the part by name: world.root:find("Name").
Instance.new("Part"), Instance.CreatePart.new { name = ..., position = ... }: the properties go in the table.
workspace:Raycast, GetPartsInSphereworld:raycast { ... }, world:query { within = ... }.
TweenToentity:tween({ ... }, seconds).
RemoteEvent, RemoteFunction and their callsnet.message(name, fields): see Client scripts and interface.
DataStore, leaderstatsstore(name): see Saved data.
ScreenGui and friendsui.label and ui.button in a --!client script.
game:GetService(...)Services are gone: world, store, net and the other globals do their work.
CFrameGone. Positions and rotations are vectors (rotation is degrees about each axis).
Humanoids, rigs, tools, the backpack, seats, welds, attachments, joints, animations, particles and effects, decals, mesh partsGone from the game. Players have health, position and teleport. Kill bricks, checkpoints, jump pads, teleporters, buttons, conveyors and spinners are gone too: write them with touched and stepped_on signals.

The ideas that changed

Three differences are bigger than names:

  1. Time belongs to scopes. A loop while true do wait() end keeps running after its part is gone. Use scope:every(seconds, fn), and it ends with the script, or with entity.scope and it ends with the part. See Signals, scopes and time.
  2. A script is a file. It says where it runs with a directive (--!server, --!client, --!shared, --!module), and finds its parts by name instead of by sitting inside them.
  3. Ask the world, then act on the answer. Instead of looping over parts and setting each, world:query { ... }:set("color", c) does it in one call. See The world.