TutorialKit
A self-contained onboarding module for Roblox.
A tutorial is data: an ordered list of Steps, each holding actions that start together. Entering a step gives its actions a shared Janitor; leaving the step destroys that Janitor and clears the spotlight, the pointer and the camera, so no step has to clean up after the one before it.
This page is the facade: everything you require in one place. Start with Tutorial.build and Step.new, then pick actions from FocusUI, PointWorld, Cinematic, Dialog and Custom.
The whole thing in one screen
const TutorialKit = require(ReplicatedStorage.TutorialKit)
const Tutorial, Step = TutorialKit.Tutorial, TutorialKit.Step
const FocusUI = TutorialKit.FocusUI
Dialogs are the one thing the kit does not draw, so you bind your own renderer once, at boot,
and get back a Dialog constructor bound to it. Extra is your type, not the kit's: whatever
your dialog system needs beyond text and buttons. Annotating request is what fixes Extra
to it.
type GuideDialog = { Template: string }
const Dialog = TutorialKit.createDialogs(function(
request: TutorialKit.DialogRequest<GuideDialog>
): TutorialKit.DialogHandle?
const extra = request.Extra
const accept = request.Choices[1]
const session = DialogModule:Open({
Template = if extra then extra.Template else "Default",
NpcName = request.Speaker,
Lines = request.Lines,
AcceptText = if accept then accept.Text else nil,
})
if accept then
session.Accept:Connect(accept.Activate)
end
return { Close = function() session:Destroy() end }
end, { MaxChoices = 2 })
The tutorial itself is then plain data. Each entry in Choices is one button; pressing it calls
that choice's Activate, and Advance = true is what makes Activate move the tutorial
forward. Here the dialog's Continue button ends step 1, and the spotlight on the shop button
ends step 2.
const tutorial = Tutorial.build({
Step.new(1, {
Dialog.new({
Speaker = "Guide",
Lines = { "Welcome, traveler!" },
Choices = { { Text = "Continue", Advance = true } },
Extra = { Template = "Wooden" },
}),
}),
Step.new(2, {
FocusUI.to(shopButton, { Advance = true }),
}),
})
tutorial:Start()
:::caution The server half is a separate require This facade pulls the spotlight, the pointer and ezvisualz, so it is client only. Saving progress lives in TutorialServer, which you require directly:
const TutorialServer = require(Packages.TutorialKit.Server)
:::
The kit ships its own janitor and ezvisualz under Packages, so it never touches the host game's
dependency tree.
Properties
Tutorial
This item is read only and cannot be modified. Read OnlyTutorialKit.Tutorial: TutorialThe runtime. Tutorial.build is where a tutorial starts.
Step
This item is read only and cannot be modified. Read OnlyTutorialKit.Step: StepOne step of a flow. See Step.new.
FocusUI
This item is read only and cannot be modified. Read OnlyTutorialKit.FocusUI: FocusUIDim the screen around a GuiObject. See FocusUI.to.
PointWorld
This item is read only and cannot be modified. Read OnlyTutorialKit.PointWorld: PointWorldBeam and icon toward something in the world. See PointWorld.to.
Cinematic
This item is read only and cannot be modified. Read OnlyTutorialKit.Cinematic: CinematicCamera flights. See Cinematic.focus and Cinematic.tour.
Custom
This item is read only and cannot be modified. Read OnlyTutorialKit.Custom: CustomYour own logic as an action. See Custom.new.
Client
This item is read only and cannot be modified. Read OnlyTutorialKit.Client: TutorialClientThe client half of the server bridge. Driven for you when a tutorial replicates.
UI
This item is read only and cannot be modified. Read OnlyTutorialKit.UI: UIDeclarative instance builder, for writing a dialog renderer without a UI framework.
Signal
This item is read only and cannot be modified. Read OnlyTutorialKit.Signal: SignalThe signal implementation behind every event the kit exposes.
Spotlight
This item is read only and cannot be modified. Read OnlyTutorialKit.Spotlight: SpotlightThe dim overlay, for use outside a tutorial.
WorldPointer
This item is read only and cannot be modified. Read OnlyTutorialKit.WorldPointer: WorldPointerWorld guidance, for use outside a tutorial.
CameraTour
This item is read only and cannot be modified. Read OnlyTutorialKit.CameraTour: CameraTourCamera flights, for use outside a tutorial.
Functions
createDialogs
constructorBinds your dialog renderer and returns a typed Dialog constructor.
Documented in full on Dialog.createDialogs.