CaptureService
*Pronto este contenido estará disponible en tu idioma seleccionado.
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
Takes a screenshot and provides a temporary contentId to identify it.
Prompts the user to save specified captures to their gallery.
- PromptShareCapture(contentId : ContentId,launchData : string,onAcceptedCallback : function,onDeniedCallback : function):void
Prompts the user to share a specified screenshot capture. .
Eventos
Fires immediately before a capture begins.
Fires after a capture finishes.
Fires when the user saves a capture.
Propiedades
Métodos
CaptureScreenshot
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
A callback function that is called with the contentId of the new capture once it is ready.
Devuelve
PromptSaveCapturesToGallery
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
An array of contentId strings identifying the screenshots to save.
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
PromptShareCapture
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
The contentId identifying the screenshot to share.
An optional string to include as launch data in the invite link.
An optional callback function invoked if the user accepts sharing.
An optional callback function invoked if the user denies sharing.
Devuelve
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
The contentId identifying the screenshot that the user saved.