Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local partsWithId = {}
- local awaitRef = {}
- local root = {
- ID = 0;
- Type = "TextButton";
- Properties = {
- TextWrapped = true;
- TextColor3 = Color3.new(241/255,1,50/51);
- Text = "Open";
- Size = UDim2.new(0,269,0,100);
- Font = Enum.Font.SciFi;
- Name = "Open";
- FontSize = Enum.FontSize.Size14;
- TextSize = 14;
- BackgroundColor3 = Color3.new(0,0,0);
- TextScaled = true;
- TextWrap = true;
- };
- Children = {};
- };
- local function Scan(item, parent)
- local obj = Instance.new(item.Type)
- if (item.ID) then
- local awaiting = awaitRef[item.ID]
- if (awaiting) then
- awaiting[1][awaiting[2]] = obj
- awaitRef[item.ID] = nil
- else
- partsWithId[item.ID] = obj
- end
- end
- for p,v in pairs(item.Properties) do
- if (type(v) == "string") then
- local id = tonumber(v:match("^_R:(%w+)_$"))
- if (id) then
- if (partsWithId[id]) then
- v = partsWithId[id]
- else
- awaitRef[id] = {obj, p}
- v = nil
- end
- end
- end
- obj[p] = v
- end
- for _,c in pairs(item.Children) do
- Scan(c, obj)
- end
- obj.Parent = parent
- return obj
- end
- return function() return Scan(root, nil) end
Advertisement
Add Comment
Please, Sign In to add comment