local Symbol = require(script.Parent.Symbol)
local Nil = Symbol.named("Nil")
local _cachedPropertyValues = {}
local function getDefaultInstanceProperty(className, propertyName)
local classCache = _cachedPropertyValues[className]
if classCache then
local propValue = classCache[propertyName]
if propValue == Nil then
return true, nil
end
if propValue ~= nil then
return true, propValue
end
else
classCache = {}
_cachedPropertyValues[className] = classCache
end
local created = Instance.new(className)
local ok, defaultValue = pcall(function()
return created[propertyName]
end)
created:Destroy()
if ok then
if defaultValue == nil then
classCache[propertyName] = Nil
else
classCache[propertyName] = defaultValue
end
end
return ok, defaultValue
end
return getDefaultInstanceProperty