Function getrawmetatable() written in pure Luau (copyrawmetatable())

You want me to remake it? Here (Literally works exactly the same)

function copyrawmetatable(object)
	local metatable = getmetatable(object)
	local success = pcall(setmetatable, object, metatable)
	
	if (not success) and metatable ~= nil then
		if typeof(object) ~= type(object) then			
			return {
				__index = "function",
				__metatable = metatable,
				__namecall = "function",
				__newindex = "function",
				__type = typeof(object)
			}
		else
			return {
				__metatable = metatable
			}
		end
	end

	-- else
	return metatable
end