Hello Creators,
Today we’re launching new APIs for captures, allowing you to control how the captures feature integrates with your experiences.
Last year, we released captures, which allow people to take a screenshot, save, and share a snapshot of what is displayed on their device screen within an experience. We are exploring expanding to enable video and other formats in the future. For more details on captures, see Help FAQ here.
As we shared in a recent blog post, when people connect with friends on Roblox, they return more often to explore experiences together, which drives engagement. Captures make it easier for users to share screenshots and invite their friends to join their experience which improves discoverability, and fosters a vibrant community.
To date, this feature has seen widespread adoption in terms of volume and frequency of use, as users have collectively taken over half a billion screenshots and shared 200K screenshots every day.
Captures APIs
The Captures APIs will allow you to include pre-set moments within your experience where a screenshot is automatically taken for users. Users will have the option to save, share, or delete the screenshot.
Since you know your experiences best, you can identify the most interesting moments and achievements to capture. Prompting users to take captures will encourage more content sharing and in turn, allow new users to find and try your experience.
Imagine taking a screenshot and saving a close finish for a car race or an awesome hole-in-one in a golf experience! There are endless ways for you to make the most of those memorable moments in your experience.
CaptureService APIs
[Method] CaptureService:CaptureScreenshot(onCaptureReady(contentId))
This new API allows you to automatically capture a screenshot for a user in your experience.
The screenshot is not immediately saved to the user’s Captures — instead, a temporary ContentId
will be created for the new capture. You can use the onCaptureReady
callback to prompt the user to save or share the screenshot. The user can then choose whether they would like to save the capture or not.
[Method] CaptureService:PromptShareCapture(contentId, launchData, onAcceptedCallback, onDeniedCallback)
This API allows you to prompt a user to share a capture using the native share sheet on their device. The capture image will be shared along with an invite to the experience (where supported). Note: Not all devices and/or apps support including both a screenshot and an invite link, so results may vary.
The launchData
string will be available in the JoinData
for users who join through the invite link. See developer deeplinking.
An error will be thrown if the user is not able to share content (i.e it’s not supported or their privacy settings do not allow this). The developer can check the new PolicyService IsContentSharingAllowed
field to avoid this error.
Example usage:
local CaptureService = game:GetService("CaptureService")
local captureLaunchData = {
isScreenshotInvite = true,
inviterUserId = 2231221,
}
local launchData = HttpService:JSONEncode(captureLaunchData)
CaptureService:PromptShareCapture(captureContentId, launchData)
[Method] CaptureService:PromptSaveCapturesToGallery({contentIds}, resultCallback({[contentId]: boolean})
This API can be used to prompt a user to save captures to their Captures Gallery.
Example usage:
local CaptureService = game:GetService("CaptureService")
local userRejectedSaveCaptures = false
local function resultCallback(results)
local allRejected = true
for contentId, accepted in results do
if accepted then
allRejected = false
end
end
if allRejected then
-- user might not want developer captures, don't prompt again
userRejectedSaveCaptures = true
end
end
local function onRoundEnded(gameplayCaptures)
if #gameplayCaptures == 0 or userRejectedSaveCaptures then
return
end
CaptureService:PromptSaveCapturesToGallery(gameplayCaptures, resultCallback)
end
[Event] CaptureService.UserCaptureSaved(contentId)
This event can be used to determine when a user has taken a capture in your experience and can be used for analytics or for prompting users to share their captures.
[Event] CaptureService.CaptureBegan()
The CaptureBegan
event is fired immediately before a capture begins and can be used to customize the Captures experience in your experience (for example customizing what GUI elements are hidden).
[Event] CaptureService.CaptureEnded()
The CaptureEnded
event is fired after a capture finishes and can be used to restore any changes made by your code when the CaptureBegan
fired.
Additional APIs
ScreenshotHud
There is an existing ScreenshotHud
singleton that is automatically created and parented to GuiService. The Captures feature will read from the existing OverlayFont
, UsernameOverlayEnabled
and ExperienceNameOverlayEnabled
properties to allow you to customize the watermark in your experience.
Two new properties are being added to ScreenshotHud
to allow additional control of the Captures feature:
-
bool HideCoreGuiForCaptures (default true)
- When true, the CoreGui will be hidden when new screenshot captures are taken.
-
bool HidePlayerGuiForCaptures (default true)
- When true, the PlayerGui will be hidden when new screenshot captures are taken.
CoreGuiType Enum
CoreGuiType.Captures = 7
There is a new Captures EnumItem for the CoreGuiType
Enum, which you can use to disable the captures feature with the StarterGui:SetCoreGuiEnabled()
API.
Usage:
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Captures, false)
What’s Next
Currently, users can only take captures on desktop and mobile devices. We are looking into expanding to more platforms and adding video support and other formats in the future. We are excited to see what awesome moments your users will capture and share! Please share any feedback in the comments below.