Skip to content

Commit d3f719c

Browse files
authored
Update CaptureService.yaml (#886)
## Changes <!-- Please summarize your changes. --> <!-- Please link to any applicable information (forum posts, bug reports, etc.). --> ## Checks By submitting your pull request for review, you agree to the following: - [ ] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [ ] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [ ] To the best of my knowledge, all proposed changes are accurate.
1 parent bed10b3 commit d3f719c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

content/en-us/reference/engine/classes/CaptureService.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,20 @@ methods:
2727
Instead, a temporary `contentId` is created to identify the new capture.
2828
2929
The `onCaptureReady` callback can be used to prompt the user to save or
30-
share the screenshot.
30+
share the screenshot:
31+
32+
```lua
33+
local CaptureService = game:GetService("CaptureService")
34+
35+
-- Reference to an ImageLabel parent of the script containing this code
36+
local imageLabel = script.Parent
37+
38+
local function onCaptureReady(contentId)
39+
imageLabel.Image = contentId
40+
end
41+
42+
CaptureService:CaptureScreenshot(onCaptureReady)
43+
```
3144
code_samples: []
3245
parameters:
3346
- name: onCaptureReady

0 commit comments

Comments
 (0)