看板 Storage_Zone 關於我們 聯絡資訊

Roblox Saveinstance Script [TESTED]

local ALLOWLIST = { Part = {"Anchored","CanCollide","Size","Material","Color"}, Model = {}, IntValue = {"Value"}, StringValue = {"Value"}, BoolValue = {"Value"}, }

local function serializeInstance(inst, depth, maxDepth) if depth > maxDepth then return nil end local node = { className = inst.ClassName, name = inst.Name, properties = getSafeProps(inst), values = {}, children = {}, } for _, child in ipairs(inst:GetChildren()) do if child:IsA("ValueBase") then local vprops = getSafeProps(child) table.insert(node.values, {class = child.ClassName, name = child.Name, properties = vprops}) elseif not child:IsA("ModuleScript") and not child:IsA("Script") and not child:IsA("LocalScript") then local cnode = serializeInstance(child, depth+1, maxDepth) if cnode then table.insert(node.children, cnode) end end end return node end Roblox SaveInstance Script

-- Requires HttpService local HttpService = game:GetService("HttpService") Model = {}

local function instantiateNode(node, parent) local ok, inst = pcall(function() return Instance.new(node.className) end) if not ok then return nil end inst.Name = node.name or node.className applyProps(inst, node.properties) inst.Parent = parent for _, v in ipairs(node.values or {}) do local ok2, valInst = pcall(function() return Instance.new(v.class) end) if ok2 then valInst.Name = v.name applyProps(valInst, v.properties) valInst.Parent = inst end end for _, c in ipairs(node.children or {}) do instantiateNode(c, inst) end return inst end IntValue = {"Value"}