Save a photo capture a player made on ImageLabel

Hi I am using the captures api so it displays a photo on an imagelabel. I don’t know much about this but is there a way to save it to like a datastore or something so it can always be there? I need this because I am making a game where people can make their worlds and I need it so they can take a photo of their world so it shows on the world page

script.Parent.MouseButton1Down:Connect(function()
	local CaptureService = game:GetService("CaptureService")

	local imageLabel = script.Parent.Parent.ImageLabel

	local function onCaptureReady(contentId)
		imageLabel.Image = contentId
	end
	CaptureService:CaptureScreenshot(onCaptureReady)
end)
1 Like

Im guessing just when you set the image just save the content ID when the player leaves if thats what you looking for

1 Like

It’s temporary and probably client-sided

1 Like

yes, but what OP could do is save the content id, check for the id, and then load that specific id, but saved on a server script.

local player = game.Players.LocalPlayer -- cache and get the player

-- get the saved image id (save it on the server)
local savedImageId = player:WaitForChild(savedImageId, 10)

local function idk()
  -- check if there was a save
  if savedImageId then
      --load it
  end
end)

script.Parent.MouseButton1Down:Connect(function()
	local CaptureService = game:GetService("CaptureService")

	local imageLabel = script.Parent.Parent.ImageLabel

	local function onCaptureReady(contentId)
		imageLabel.Image = contentId
	end
	CaptureService:CaptureScreenshot(onCaptureReady)
end)
2 Likes

ohh yeah thats probably true
sorry I dont know a whole lot about the capture service

I will try this later and see if it works