学ぶ
エンジンクラス
CaptureService
作成できません
サービス

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


概要
方法
CaptureScreenshot(onCaptureReady: function):()
PromptSaveCapturesToGallery(captures: {any},resultCallback: function):()
PromptShareCapture(captureContent: Content,launchData: string,onAcceptedCallback: function,onDeniedCallback: function):()
ReadCapturesFromGalleryAsync(captureTypeFilters: {any},readFromAllEligibleExperiences: boolean):Tuple
TakeScreenshotCaptureAsync(onCaptureReady: function,captureParams: Dictionary):()
継承されたメンバー

APIリファレンス
方法
CaptureScreenshot
機能: Capture
CaptureService:CaptureScreenshot(onCaptureReady:function):()
パラメータ
onCaptureReady:function
戻り値
()

CheckUploadCaptureStatusAsync
イールド
機能: Capture
CaptureService:CheckUploadCaptureStatusAsync(token:string):Tuple
パラメータ
token:string
戻り値

PromptCaptureGalleryPermissionAsync
イールド
機能: Capture
CaptureService:PromptCaptureGalleryPermissionAsync(captureGalleryPermission:Enum.CaptureGalleryPermission):boolean
パラメータ
captureGalleryPermission:Enum.CaptureGalleryPermission
戻り値
コードサンプル
キャプチャギャラリーの権限を要求する
local CaptureService = game:GetService("CaptureService")
local function isGalleryAccessGranted()
-- ユーザーにキャプチャギャラリーへのアクセスを要求する
local accepted = CaptureService:PromptCaptureGalleryPermissionAsync(Enum.CaptureGalleryPermission.ReadAndUpload)
return accepted
end

PromptSaveCapturesToGallery
機能: Capture
CaptureService:PromptSaveCapturesToGallery(
captures:{any}, resultCallback:function
):()
パラメータ
captures:{any}
resultCallback:function
戻り値
()

PromptShareCapture
機能: Capture
CaptureService:PromptShareCapture(
captureContent:Content, launchData:string, onAcceptedCallback:function, onDeniedCallback:function
):()
パラメータ
captureContent:Content
launchData:string
onAcceptedCallback:function
onDeniedCallback:function
戻り値
()

ReadCapturesFromGalleryAsync
イールド
機能: Capture
CaptureService:ReadCapturesFromGalleryAsync(
captureTypeFilters:{any}, readFromAllEligibleExperiences:boolean
パラメータ
captureTypeFilters:{any}
既定値: "{}"
readFromAllEligibleExperiences:boolean
既定値: false
戻り値
コードサンプル
ギャラリーからキャプチャを読み取り、ページを反復処理する
local CaptureService = game:GetService("CaptureService")
local function readCapturesFromGallery()
local allCaptures = {}
local capturesPages
local success, result = pcall(function()
local readResult, pages = CaptureService:ReadCapturesFromGalleryAsync({}, false)
if readResult == Enum.ReadCapturesFromGalleryResult.Success then
capturesPages = pages
end
return readResult
end)
if not success or result ~= Enum.ReadCapturesFromGalleryResult.Success then
-- おそらく権限エラーです。CaptureService:PromptCaptureGalleryPermissionAsync() を確認してください。
warn("初期キャプチャの取得に失敗しました: " .. result.Name)
return
end
-- 現在のページを反復処理します
local currentPage = capturesPages:GetCurrentPage()
for _, capture in currentPage do
table.insert(allCaptures, capture)
end
-- 完了するまで次のページに進みます
while not capturesPages.IsFinished do
local advanceToNextPageSuccess, _ = pcall(function()
capturesPages:AdvanceToNextPageAsync()
end)
if not advanceToNextPageSuccess then
return
end
currentPage = capturesPages:GetCurrentPage()
for _, capture in currentPage do
table.insert(allCaptures, capture)
end
end
return allCaptures
end

StartUploadCaptureAsync
イールド
機能: Capture
CaptureService:StartUploadCaptureAsync(capture:Capture):Tuple
パラメータ
capture:Capture
戻り値

StartVideoCaptureAsync
イールド
機能: Capture
CaptureService:StartVideoCaptureAsync(
onCaptureReady:function, captureParams:Dictionary
パラメータ
onCaptureReady:function
captureParams:Dictionary
既定値: "nil"

StopVideoCapture
機能: Capture
CaptureService:StopVideoCapture():()
戻り値
()

TakeScreenshotCaptureAsync
機能: Capture
CaptureService:TakeScreenshotCaptureAsync(
onCaptureReady:function, captureParams:Dictionary
):()
パラメータ
onCaptureReady:function
captureParams:Dictionary
既定値: "nil"
戻り値
()

UploadCaptureAsync
イールド
機能: Capture
CaptureService:UploadCaptureAsync(capture:Capture):Tuple
パラメータ
capture:Capture
戻り値
コードサンプル
アセットシステムにキャプチャをアップロード
local CaptureService = game:GetService("CaptureService")
local function uploadCapture(capture: Capture)
local success, result = pcall(function()
local uploadCaptureResult, assetId = CaptureService:UploadCaptureAsync(capture)
if uploadCaptureResult ~= Enum.UploadCaptureResult.Success then
-- 失敗を処理する
return nil
end
return assetId
end)
if not success then
-- エラーを処理する
return nil
end
return result
end

イベント
CaptureBegan
機能: Capture
CaptureService.CaptureBegan(captureType:Enum.CaptureType):RBXScriptSignal
パラメータ
captureType:Enum.CaptureType

CaptureEnded
機能: Capture
CaptureService.CaptureEnded(captureType:Enum.CaptureType):RBXScriptSignal
パラメータ
captureType:Enum.CaptureType

CaptureSaved
非推奨

UserCaptureSaved
機能: Capture
CaptureService.UserCaptureSaved(captureContentId:ContentId):RBXScriptSignal
パラメータ
captureContentId:ContentId

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。