Not being prompted to save captures

I’m writing this game and the captures are supposed to be prompted to save. I pretty much copied the code from the docs.
The video starts, ends, but the capture is never prompted to be saved

local Exporter = {}

local CaptureService = game:GetService("CaptureService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Bindables = ReplicatedStorage.Bindables
local PlayerGui = game:GetService("Players").LocalPlayer:FindFirstChildWhichIsA("PlayerGui")
local workspaceVideo = workspace:WaitForChild("ExportVideoPart").VideoGui.Background.Video :: VideoFrame

local currentTracks = {}

local function onCaptureReady(result: Enum.VideoCaptureResult, videoCapture: VideoCapture)
	warn(result, videoCapture)
	if (result ~= Enum.VideoCaptureResult.Success and result ~= Enum.VideoCaptureResult.TimeLimitReached) or not videoCapture then
		Bindables.CreateNotification:Fire("Error", `Failed to create video: {result.Name} - Video capture: {videoCapture}`)
	else
		warn("saving to gallery", videoCapture)
		CaptureService:PromptSaveCapturesToGallery({ videoCapture }, function(result)
			local saved = false
			for _, v in result do
				saved = v
				break
			end
			print(saved)
		end)
	end
end

function Exporter.export(data: {any}, videoSize: "Fit" | "Fill")
	currentTracks = data.tracks
	for _, v in PlayerGui:GetChildren() do
		if v:IsA("ScreenGui") then
			v.Enabled = false
		end
	end
	PlayerGui.Scripts.ExportHandler.FillScreen.Value = videoSize == "Fill"
	
	local videoRecordingAllowedResult: Enum.VideoCaptureStartedResult = CaptureService:StartVideoCaptureAsync(onCaptureReady, {})
	if videoRecordingAllowedResult ~= Enum.VideoCaptureStartedResult.Success then
		Bindables.CreateNotification:Fire("Warning", "Video recording failed to start for reason:" .. videoRecordingAllowedResult.Name)
		return
	end
	
	workspaceVideo.Video = data.videoId
	workspaceVideo.Volume = data.videoVolume
	
	repeat task.wait() until workspaceVideo.Loaded

	workspaceVideo:Play()
	
	workspaceVideo.Ended:Wait()
	
	CaptureService:StopVideoCapture()
end

function Exporter.getExportedTracks()
	return currentTracks
end

return Exporter

Found a solution

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.