Custom
The escape hatch, for the parts of a tutorial the kit does not model.
It is a first-class action, not a workaround: you get the same ActionContext and the same cleanup as everything built in, which is what keeps custom logic from leaking between steps.
Functions
new
constructorWraps your own function as an action.
Waiting for something to happen
The most common use: end the step on a game event rather than a click.
Custom.new(function(context)
const connection = QuestService.Completed:Connect(function(questId)
if questId == "FirstDelivery" then
context:Advance()
end
end)
context.Janitor:add(connection, "Disconnect")
end)
Registering the connection on context.Janitor is what matters here. Without it the listener
survives the step and fires again later, on a tutorial that has moved on.
Reaching the guidance tools directly
Custom.new(function(context)
context.Pointer:Outline(bossModel)
task.delay(5, function()
context.Spotlight:Clear()
end)
end)
A timed step
Custom.new(function(context)
const thread = task.delay(10, function()
context:Advance()
end)
context.Janitor:add(thread, true)
end)
CAUTION
run is called synchronously while the step opens, and the other actions of that step have not
all started yet. Do not yield in it; start a thread instead, and put that thread on the Janitor
so leaving the step cancels it.