Is CaptureService broken?

Whilst working on a game I was looking if anyone had made a type of “Auto exposure” that many realistic games use to add just that extra neat detail. With a quick search I found what I was looking for and I tried it for myself, not knowing I would go through hell trying to fix the code.

Of course, it didn’t work. When searching online I found that the code had some small issues, but that didn’t fix it. After some hours I found that the LocalScript stopped working after calling
CaptureScreenshot, which was weird, there were no spelling mistakes and according the main Documentation of how capture service works from Roblox this should be functioning normally…

Now here’s where the endless searching for a solution began, but lets just say that lead nowhere…

The code down below is my latest attempt, following a basic tutorial on capturing and saving a screenshot. But yet it still didn’t work

local CaptureService = game:GetService( "CaptureService")
local GuiService = game:GetService( "GuiService")
local ScreenshotHud = GuiService:WaitForChild("ScreenshotHud")

ScreenshotHud.HidePlayerGuiForCaptures = true
ScreenshotHud.HideCoreGuiForCaptures = true

local function screenshotCompleted(contentId)
	CaptureService:PromptSaveCapturesToGallery(contentId)
end
wait(5)

print ("Take a capture!")
CaptureService:CaptureScreenshot(screenshotCompleted)

So what’s happening? Is this a silly mistake on my end or is capture service just broken for some devices?

This is the issue to the problem! (I got fooled the same way lol)

What is actually correct is

CaptureService:PromptSaveCapturesToGallery({contentId},function(callback)
	--Function here after screen prompt ended
end)

If you don’t wanna use a function on end just don’t put anything in the function, if you do wanna check if the screenshot has been saved or not, you can do

CaptureService:PromptSaveCapturesToGallery:PromptSaveCapturesToGallery({contentId},function(callback)
	if callback[contentId] == true then
		print("User saved image: "..id)
	elseif callback[contentId] == false then
		print("User did not save image: "..id)
	end
end)

I didn’t test this so if there’s an error, tell me!

Also here’s the full screen so you just have to copy paste

local CaptureService = game:GetService("CaptureService")
local GuiService = game:GetService("GuiService")
local ScreenshotHud = GuiService:WaitForChild("ScreenshotHud")

ScreenshotHud.HidePlayerGuiForCaptures = true
ScreenshotHud.HideCoreGuiForCaptures = true

local function screenshotCompleted(contentId)
	CaptureService:PromptSaveCapturesToGallery:PromptSaveCapturesToGallery({contentId},function(callback)
		if callback[contentId] == true then
			print("User saved image: "..id)
		elseif callback[contentId] == false then
			print("User did not save image: "..id)
		end
	end)
end
wait(5)

print ("Take a capture!")
CaptureService:CaptureScreenshot(screenshotCompleted)
1 Like

I tried using the provided code (There were some spelling mistakes but I swiftly fixed that) but nothing happened. I wish the issue was as simple as that but the issue lies at the last line,

CaptureService:CaptureScreenshot(screenshotCompleted)

Basically the function doesn’t even work. So when I try to print something inside of the screenshotCompleted function nothing comes out. And worse is that the terminal has shown no errors.

Alright, so I just tested and fixed it
Now it should work (I tested it and it works for me at least!)

local CaptureService = game:GetService("CaptureService")
local GuiService = game:GetService("GuiService")
local ScreenshotHud = GuiService:WaitForChild("ScreenshotHud")

ScreenshotHud.HidePlayerGuiForCaptures = true
ScreenshotHud.HideCoreGuiForCaptures = true

local function screenshotCompleted(contentId)
	CaptureService:PromptSaveCapturesToGallery({contentId},function(callback)
		if callback[contentId] == true then
			print("User saved image: "..contentId)
		elseif callback[contentId] == false then
			print("User did not save image: "..contentId)
		end
	end)
end
task.wait(5)

print("Take a capture!")
CaptureService:CaptureScreenshot(screenshotCompleted)

1 Like

Oh! It finally worked! The reason for my confusion was that I have to play the game on Roblox to make it work! Thank you for helping me, I hope you have a great day :wink:

1 Like