CaptureService

Mostrar obsoleto

*Pronto este contenido estará disponible en tu idioma seleccionado.

No creable
Servicio

CaptureService is a client-side service that allows developers to control how the screenshot capture feature integrates with their experiences. It can be used to include preset moments where a screenshot is automatically taken for a user, and that user can then save, share, or delete the screenshot.

Resumen

Métodos

Eventos

Propiedades

Métodos

CaptureScreenshot

void

This method captures a screenshot for the user but does not immediately save it to their Captures gallery within the experience's main menu. Instead, a temporary contentId is created to identify the new capture.

The onCaptureReady callback can be used to prompt the user to save or share the screenshot:


local CaptureService = game:GetService("CaptureService")
-- Reference to an ImageLabel parent of the script containing this code
local imageLabel = script.Parent
local function onCaptureReady(contentId)
imageLabel.Image = contentId
end
CaptureService:CaptureScreenshot(onCaptureReady)

Parámetros

onCaptureReady: function

A callback function that is called with the contentId of the new capture once it is ready.


Devuelve

void

PromptSaveCapturesToGallery

void

This method prompts the user to save the screenshots identified by the provided contentIds to their Captures gallery within the experience's main menu.

Parámetros

contentIds: Array

An array of contentId strings identifying the screenshots to save.

resultCallback: function

A callback function that will be invoked with a dictionary mapping each contentId to a boolean indicating if the user accepted saving that capture.


Devuelve

void

PromptShareCapture

void

This method prompts the user to share the screenshot identified by the provided contentId using the native share sheet on their device.

The capture image will be shared along with an invite link to the experience when supported. Not all devices/apps support including both a screenshot and invite link.

The launchData will be available in the launchData field for users who join through the invite link.

Parámetros

contentId: ContentId

The contentId identifying the screenshot to share.

launchData: string

An optional string to include as launch data in the invite link.

onAcceptedCallback: function

An optional callback function invoked if the user accepts sharing.

onDeniedCallback: function

An optional callback function invoked if the user denies sharing.


Devuelve

void

Eventos

CaptureBegan

This event fires right before a new screenshot capture is taken. It can be used to customize the capture experience, for example by hiding certain GUI elements.


CaptureEnded

This event fires after a new screenshot capture completes. It can be used to restore any changes made when the CaptureBegan event fired.


UserCaptureSaved

This event fires when the user saves a screenshot using the Roblox screenshot capture UI. It can be used for analytics or to prompt the user to share their capture.

Parámetros

captureContentId: ContentId

The contentId identifying the screenshot that the user saved.