<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<OpenJobEx xmlns="http://roblox.com/">
			<job>
				<id>{JobID}</id>
				<expirationInSeconds>120</expirationInSeconds>
				<category>1</category>
				<cores>1</cores>
			</job>
			<script>
				<name>RenderScript</name>
				<script>
-- Place v1.0.2

local baseUrl, thumbnailKey, renderType, assetId, synchronous = ...

local ThumbnailGenerator = game:GetService("ThumbnailGenerator")

pcall(function()
	game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
	game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/Asset/?id=%d")
	game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
end)

game:GetService("HttpService").HttpEnabled = true
game:GetService("ScriptContext").ScriptsDisabled = true
game:GetService("StarterGui").ShowDevelopmentGui = false
	
print("[" .. game.JobId .. "] Starting new render for " .. renderType .. " ID " .. assetId)
game:HttpPost(baseUrl .. "/api/render/update?ApiKey=" .. thumbnailKey .. "&amp;RenderJobID=" .. game.JobId, '{"Status": 1}', true, "text/plain", true)

success, error = pcall(function() game:Load(baseUrl .. "/Asset/?id=" .. assetId .. "&amp;force=true&amp;t=" .. tick()) end)

if not success then
	print("[" .. game.JobId .. "] Failed to load map! (" .. error .. ")")
	game:HttpPost(baseUrl .. "/api/render/update?ApiKey=" .. thumbnailKey .. "&amp;RenderJobID=" .. game.JobId, '{"Status": 3, "Message": "Failed to load map! (' .. error .. ')"}', true, "text/plain", true)
else
	-- Do this after again loading the place file to ensure that these values aren't changed when the place file is loaded.
	game:GetService("HttpService").HttpEnabled = true
	game:GetService("ScriptContext").ScriptsDisabled = true
	game:GetService("StarterGui").ShowDevelopmentGui = false

	local click = ThumbnailGenerator:Click("PNG", 840, 840, false)
	local clickWidescreen = ThumbnailGenerator:Click("PNG", 1536, 864, false)
		
	result = '{"Status": 2, "Click": "' .. tostring(click) .. '", "ClickWidescreen": "' .. tostring(clickWidescreen) .. '"}'
	print("[" .. game.JobId .. "] Successfully rendered, uploading...")

	while true do
		success, error = pcall(function() game:HttpPost(baseUrl .. "/api/render/update?ApiKey=" .. thumbnailKey .. "&amp;RenderJobID=" .. game.JobId, result, true, "text/plain", true) end)
		if not success then
			print("[" .. game.JobId .. "] An error occurred! (" .. error .. "). Uploading again...")
		else
			print("[" .. game.JobId .. "] Upload successful! Moving on...")
			break
		end
	end
end
				</script>
				<arguments>
					<LuaValue>
						<type>LUA_TSTRING</type>
						<value>{BaseURL}</value>
					</LuaValue>
					<LuaValue>
						<type>LUA_TSTRING</type>
						<value>{ThumbnailKey}</value>
					</LuaValue>
					<LuaValue>
						<type>LUA_TSTRING</type>
						<value>{RenderType}</value>
					</LuaValue>
					<LuaValue>
						<type>LUA_TNUMBER</type>
						<value>{AssetID}</value>
					</LuaValue>
					<LuaValue>
						<type>LUA_TBOOLEAN</type>
						<value>{Synchronous}</value>
					</LuaValue>
				</arguments>
			</script>
		</OpenJobEx>
	</soap:Body>
</soap:Envelope>