-- 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