mirror of
https://github.com/luau/UniversalSynSaveInstance.git
synced 2026-02-04 06:33:10 +02:00
Fixed specialproperties Edge Case
The script should work on Codex and other executors again!
This commit is contained in:
@@ -389,19 +389,25 @@ for _, StaysRaw in ipairs({
|
||||
end
|
||||
end
|
||||
|
||||
if globalcontainer.getspecialinfo then
|
||||
local old_getspecialinfo = globalcontainer.getspecialinfo
|
||||
|
||||
globalcontainer.getspecialinfo = function(instance)
|
||||
local ok, result = pcall(old_getspecialinfo, instance) -- * Some executors only allow certain Classes for this method (like UnionOperation, MeshPart, Terrain), for example Electron, Codex
|
||||
return ok and result or {}
|
||||
end
|
||||
end
|
||||
|
||||
if getproperties then
|
||||
if globalcontainer.getspecialinfo then
|
||||
local getreal = globalcontainer.getspecialinfo
|
||||
local old_getspecialinfo = globalcontainer.getspecialinfo
|
||||
|
||||
globalcontainer.getspecialinfo = function(instance)
|
||||
local specialinfo = getproperties(instance)
|
||||
|
||||
local ok, result = pcall(getreal, instance) -- * Some executors only allow certain Classes for this method (like UnionOperation, MeshPart, Terrain), for example Electron
|
||||
if ok then
|
||||
for Property, Value in next, result do
|
||||
for Property, Value in next, old_getspecialinfo(instance) do
|
||||
specialinfo[Property] = Value
|
||||
end
|
||||
end
|
||||
|
||||
return specialinfo
|
||||
end
|
||||
@@ -1004,7 +1010,7 @@ local function synsaveinstance(CustomOptions)
|
||||
total = total .. savestr
|
||||
writefile(placename, total)
|
||||
if StatusTextClone then
|
||||
StatusTextClone.Text = "Saving " .. getsizeformat()
|
||||
StatusTextClone.Text = "Saving.. Size: " .. getsizeformat()
|
||||
end
|
||||
savebuffer = {}
|
||||
rwait()
|
||||
@@ -1402,7 +1408,7 @@ local function synsaveinstance(CustomOptions)
|
||||
task.wait(Log10 * 2 + 3)
|
||||
else
|
||||
StatusTextClone.Text = "Failed! Check F9 console for more info"
|
||||
warn("Error encountered while saving")
|
||||
warn("Error found while saving")
|
||||
warn("Information about error:")
|
||||
warn(err)
|
||||
task.wait(Log10 + 3)
|
||||
|
||||
@@ -391,19 +391,25 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
if globalcontainer.getspecialinfo then
|
||||
local old_getspecialinfo = globalcontainer.getspecialinfo
|
||||
|
||||
globalcontainer.getspecialinfo = function(instance)
|
||||
local ok, result = pcall(old_getspecialinfo, instance) -- * Some executors only allow certain Classes for this method (like UnionOperation, MeshPart, Terrain), for example Electron, Codex
|
||||
return ok and result or {}
|
||||
end
|
||||
end
|
||||
|
||||
if getproperties then
|
||||
if globalcontainer.getspecialinfo then
|
||||
local getreal = globalcontainer.getspecialinfo
|
||||
local old_getspecialinfo = globalcontainer.getspecialinfo
|
||||
|
||||
globalcontainer.getspecialinfo = function(instance)
|
||||
local specialinfo = getproperties(instance)
|
||||
|
||||
local ok, result = pcall(getreal, instance) -- * Some executors only allow certain Classes for this method (like UnionOperation, MeshPart, Terrain), for example Electron
|
||||
if ok then
|
||||
for Property, Value in result do
|
||||
for Property, Value in old_getspecialinfo(instance) do
|
||||
specialinfo[Property] = Value
|
||||
end
|
||||
end
|
||||
|
||||
return specialinfo
|
||||
end
|
||||
@@ -1006,7 +1012,7 @@ local function synsaveinstance(CustomOptions)
|
||||
total ..= savestr
|
||||
writefile(placename, total)
|
||||
if StatusTextClone then
|
||||
StatusTextClone.Text = "Saving " .. getsizeformat()
|
||||
StatusTextClone.Text = "Saving.. Size: " .. getsizeformat()
|
||||
end
|
||||
savebuffer = {}
|
||||
rwait()
|
||||
@@ -1396,7 +1402,7 @@ local function synsaveinstance(CustomOptions)
|
||||
task.wait(Log10 * 2 + 3)
|
||||
else
|
||||
StatusTextClone.Text = "Failed! Check F9 console for more info"
|
||||
warn("Error encountered while saving")
|
||||
warn("Error found while saving")
|
||||
warn("Information about error:")
|
||||
warn(err)
|
||||
task.wait(Log10 + 3)
|
||||
|
||||
Reference in New Issue
Block a user