@rbxts/services needs no setup. Each export is the same object game.GetService(...) returns.
import { HttpService, RunService, UserInputService } from "@rbxts/services";
HttpService === game.GetService("HttpService"); // trueWhat loom implements
| Service | What loom provides |
|---|---|
CollectionService | A real tag registry: AddTag, HasTag, GetTagged and the added/removed signals. Tags set in code only; there is no Studio tag editor. |
ContextActionService | BindAction, BindActionAtPriority, UnbindAction, UnbindAllActions, GetBoundActionInfo, GetAllBoundActionInfo. Bindings fire highest priority first, and the latest first among equal priorities. A handler returning Sink stops the chain; returning nothing is Pass. The touch-button members exist and do nothing, and BindAction creates no button. |
ContentProvider | PreloadAsync and RequestQueueSize. |
Debris | AddItem(instance, lifetime) on a real timer. The instance is destroyed. |
GuiService | SelectedObject with selection signals, GetGuiInset, ReducedMotionEnabled. |
HttpService | GenerateGUID and the JSON pair. See below. |
Players | LocalPlayer with a pre-built PlayerGui, UserId, DisplayName and GetUserThumbnailAsync. |
RunService | RenderStepped, Heartbeat, PostSimulation, Stepped, BindToRenderStep, IsStudio, IsRunning, IsClient, IsServer. |
StarterGui | A real container. SetCore, GetCore, SetCoreGuiEnabled and GetCoreGuiEnabled are no-ops. |
TextService | GetTextSize and GetTextBoundsAsync. See below. |
TweenService | Create and real tween playback. See Animation. |
UserInputService | Input signals, GetMouseLocation, GetFocusedTextBox, capability flags, IsKeyDown, GetKeysPressed, IsMouseButtonPressed, GetLastInputType. |
Workspace | CurrentCamera with a live ViewportSize. Also reachable as game.Workspace, like every service. |
These services are plain containers, so you can parent a tree into them: Lighting,
ReplicatedFirst, ReplicatedStorage, ServerScriptService, ServerStorage, SoundService,
StarterPack, StarterPlayer, Teams.
Unimplemented services
These are exported but not implemented, because each needs a Roblox server:
AnalyticsService, DataStoreService, LocalizationService, LogService, MarketplaceService,
MessagingService, PolicyService, Stats, TeleportService, TextChatService.
Importing one is safe. It logs one console warning at startup, then throws, naming the member, on the line that calls it.
To provide one yourself, point a shim at
@rbxts/services and re-export loom’s singletons alongside your own.
TextService
import { TextService } from "@rbxts/services";
const bounds = TextService.GetTextSize( "Hello world", 18, Enum.Font.SourceSans, new Vector2(200, 1000),);| Member | Behavior |
|---|---|
GetTextSize(text, fontSize, font, frameSize) | Measures with the same fonts the renderer paints with. Wraps greedily at word boundaries. A frameSize.X of 0 means no frame. |
GetTextBoundsAsync(params) | The same measurement, read from a GetTextBoundsParams instance. Does not yield. |
| Filtering methods | Absent. Moderation is a server call. |
The metrics come from the browser, so shaping and rounding can differ from the engine by a glyph. Which typeface answers depends on the fonts you install. See Fonts and text metrics.
HttpService
import { HttpService } from "@rbxts/services";
const id = HttpService.GenerateGUID(false);| Member | Behavior |
|---|---|
GenerateGUID(wrapInCurlyBraces?) | A lowercase RFC 9562 version 4 UUID in 8-4-4-4-12 form. wrapInCurlyBraces defaults to true, as in Roblox, so GenerateGUID(false) returns the bare 36 characters. |
JSONEncode / JSONDecode | JSON.stringify / JSON.parse. Arrays and objects encode as they do in Studio. JSONEncode(undefined) returns "null". Malformed JSONDecode input throws. |
GetAsync / PostAsync / RequestAsync | Throw by name. A preview never makes requests for you. |
UrlEncode | Absent. The engine encodes more than encodeURIComponent does. |
GenerateGUID uses the Web Crypto API: crypto.randomUUID() in secure contexts, otherwise
crypto.getRandomValues(). Without Web Crypto it throws instead of generating a weak ID:
[loom] HttpService.GenerateGUID requires the Web Crypto APIDatatype helpers worth knowing
const accent = Color3.fromHex("#6366F1");
Color3.fromRGB(99, 102, 241).ToHex(); // "6366f1"Color3.fromHex(colour.ToHex()) === colour; // by value| Datatype | Notes |
|---|---|
Color3.fromHex | Three or six RGB hex digits, either case, with or without one leading #. Three digits double each one, so #fff is white. Alpha channels, 0x notation and stray whitespace throw a located loom error. |
Color3:ToHex() | Six lowercase digits, no #. Each channel is clamped and rounded to the nearest 255th. |
Color3:ToHSV() / Color3.fromHSV(h, s, v) | ToHSV() destructures as a tuple. fromHSV is its inverse. |
Vector2 | Unit, Dot, Cross, Lerp, Min, Max, Abs, Floor, Ceil, Sign, Angle, FuzzyEq, and the xAxis / yAxis constants. |
Vector3 | The equivalents of the Vector2 members. |
UDim2 | Lerp, and the Width / Height components. |
UDim | No methods, as in the engine. |
Font | Font.fromId. |
NumberRange | Min / Max. |
Content | Content.fromUri, Content.fromObject, Content.none. |
ColorSequenceKeypoint / NumberSequenceKeypoint | Constructed with .new, as roblox-ts writes every construction. |