Comment on page
👆

PromptService

Service for creating Proximity Prompts.
Example usage:
-- Create a game winning prompt at the end of an obby
local emeraldBlocks = BlockService.getAllBlocks({ ItemType.EMERALD_BLOCK })
for i, block in ipairs(emeraldBlocks) do
-- Create prompt at all emerald blocks with hold duration of 3s
local prompt = PromptService.createPrompt("Goal", "Win", block.position)
prompt:setHoldDuration(3)
-- When activated end the match with the activating player as the winner
prompt:onActivated(function(player)
local team = TeamService.getTeam(player)
MatchService.endMatch(team)
end)
end
Result of running the above code

Functions

createPrompt(objectText: string, actionText: string, position: Vector3): Prompt​

Creates an in-world prompt at the specified position. You can further customize and give functionality to it using the returned Prompt object.