✓ Accepted answer
You can use pcall to run a function and if it errors then it's not cloneable:
local function Clone(Object)
local Success, Response = pcall(Object.Clone, Object)
if Success then
return Response
else
return nil, Response
end
end
Clone(workspace.Baseplate)
Clone(workspace.Terrain)
[ Success ] is a boolean which returns if the called function has ran successfully, if so, it returns the [ Response ] which in case of success is the cloned Instance. If cloning fails, however, it returns nil as nothing was cloned and the [ Response ] as second return value, in case of error it refers to the error message, string. Take in mind that if Instances's [ .Archivable ] property is set to false, the Instance cannot be cloned and will always return nil.
This pcall is called with 2 arguments, reason for that is because you normally call [ :Clone() ] with a colon (:) and in this case it's impossible so you need to pass the extra self argument manually.