local G=newproxy()local z=newproxy()local q=game:GetService("\082\117\110\083\101\114\118\105\099\101")local function u(q,u)local t=typeof(q)if t=="\102\117\110\099\116\105\111\110"then return G elseif t=="\116\104\114\101\097\100"then return z end if u then return u end if t=="\073\110\115\116\097\110\099\101"then return"\068\101\115\116\114\111\121"elseif t=="\082\066\088\083\099\114\105\112\116\067\111\110\110\101\099\116\105\111\110"then return"\068\105\115\099\111\110\110\101\099\116"elseif t=="\116\097\098\108\101"then if typeof(q.Destroy)=="\102\117\110\099\116\105\111\110"then return"\068\101\115\116\114\111\121"elseif typeof(q.Disconnect)=="\102\117\110\099\116\105\111\110"then return"\068\105\115\099\111\110\110\101\099\116"end end error("\070\097\105\108\101\100 \116\111 \103\101\116 \099\108\101\097\110\117\112 \102\117\110\099\116\105\111\110 \102\111\114 \111\098\106\101\099\116 "..(t..("\058 "..tostring(q))),3)end local function t(G)if type(G)~="\116\097\098\108\101"or type(G.getStatus)~="\102\117\110\099\116\105\111\110"or type(G.finally)~="\102\117\110\099\116\105\111\110"or type(G.cancel)~="\102\117\110\099\116\105\111\110"then error("\068\105\100 \110\111\116 \114\101\099\101\105\118\101 \097 \080\114\111\109\105\115\101 \097\115 \097\110 \097\114\103\117\109\101\110\116",3)end end
-- Trove
-- Stephen Leitnick
-- October 16, 2021

local FN_MARKER = newproxy()
local THREAD_MARKER = newproxy()

local RunService = game:GetService("RunService")

local function GetObjectCleanupFunction(object, cleanupMethod)
	local t = typeof(object)
	if t == "function" then
		return FN_MARKER
	elseif t == "thread" then
		return THREAD_MARKER
	end
	if cleanupMethod then
		return cleanupMethod
	end
	if t == "Instance" then
		return "Destroy"
	elseif t == "RBXScriptConnection" then
		return "Disconnect"
	elseif t == "table" then
		if typeof(object.Destroy) == "function" then
			return "Destroy"
		elseif typeof(object.Disconnect) == "function" then
			return "Disconnect"
		end
	end
	error("Failed to get cleanup function for object " .. t .. ": " .. tostring(object), 3)
end

local function AssertPromiseLike(object)
	if
		type(object) ~= "table"
		or type(object.getStatus) ~= "function"
		or type(object.finally) ~= "function"
		or type(object.cancel) ~= "function"
	then
		error("Did not receive a Promise as an argument", 3)
	end
end
