Is it possible to tell if you can destroy an object?

local instance = workspace
local success, result = pcall(function()
	instance.Parent = instance
end)

if string.find(result, "The Parent property of "..instance.Name.." is locked") then
	print(instance.Name.." cannot be destroyed.")
end

You can avoid firing signals this way, since attempting to set an instance as its own parent will return a different error.

1 Like