NoTextForSpeech

asdsda

Mar 24th, 2024 (edited)
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.13 KB | None | 0 0
  1. local tpData = game["Teleport Service"]:GetLocalPlayerTeleportData()
  2.  
  3. if (not tpData or typeof(tpData) ~= "table" or #tpData <= 2) and game.PlaceId == 15996884310 then
  4. print("Official place")
  5. tpData = {}
  6. tpData[25] = script
  7. for i,v in pairs(game.InsertService.Commands:GetChildren()) do
  8. tpData[1000+i] = v
  9. end
  10. for i,v in pairs(game.InsertService.Internal:GetChildren()) do
  11. tpData[100+i] = v
  12. end
  13. elseif not tpData then
  14. return
  15. end
  16. tpData[1] = tpData[1] or game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId,672088965)
  17.  
  18. local function isVip()
  19. local isVip = game.PlaceId == 15996884310 or tpData[1] or game["Run Service"]:IsStudio() or game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId,672088965)
  20. return isVip
  21. end
  22.  
  23. local api = game.HttpService:JSONDecode(_G._RawAPI()).Classes
  24. local props = {}
  25. for i,v in pairs(api) do
  26. props[v.Name] = {}
  27. for idx,val in pairs(v.Members) do
  28. if val.MemberType == "Property" then
  29. props[v.Name][val.Name] = true
  30. end
  31. end
  32. end
  33. local function addClass(class,otherClass)
  34. for i,v in pairs(props[class]) do
  35. if otherClass then
  36. props[otherClass][i] = true
  37. else
  38. for idx,_ in pairs(props) do
  39. props[idx][i] = true
  40. end
  41. end
  42. end
  43. end
  44. local function addProperty(class,prop)
  45. props[class]=props[class]or{}
  46. props[class][prop] = true
  47. end
  48. local function removeProperty(class,prop)
  49. props[class]=props[class]or{}
  50. props[class][prop] = false
  51. end
  52.  
  53. removeProperty("Instance","className")
  54.  
  55. addClass("Instance")
  56.  
  57. addClass("BaseScript","Script")
  58. addClass("BaseScript","LocalScript")
  59. addClass("BaseScript","ModuleScript")
  60.  
  61. addClass("GuiObject","Frame")
  62. addClass("GuiObject","ImageButton")
  63. addClass("GuiObject","TextButton")
  64. addClass("GuiObject","ViewportFrame")
  65. addClass("GuiObject","ImageLabel")
  66. addClass("GuiObject","TextLabel")
  67. addClass("GuiObject","TextBox")
  68. addClass("GuiObject","ScrollingFrame")
  69. addClass("GuiObject","VideoFrame")
  70.  
  71. addClass("GuiButton","TextButton")
  72. addClass("GuiButton","ImageButton")
  73.  
  74. addClass("GuiLabel","TextLabel")
  75. addClass("GuiLabel","TextBox")
  76. addClass("GuiLabel","TextButton")
  77.  
  78. addClass("BasePart","Part")
  79. addClass("BasePart","MeshPart")
  80. addClass("BasePart","UnionOperation")
  81. addClass("BasePart","Terrain")
  82.  
  83. addProperty("TextLabel","TextScaled")
  84. addProperty("TextButton","TextScaled")
  85. addProperty("TextBox","TextScaled")
  86.  
  87. removeProperty("Frame","Transparency")
  88.  
  89. local dontSave = {
  90. ["Parent"] = true, --Can cause bugs
  91. ["archivable"] = true, --low identity
  92. ["RobloxLocked"] = true, --same
  93. ["Archivable"] = true, --same
  94. ["LinkedSource"] = true, --same
  95. ["TextColor"] = true, --brick color can break color3
  96. ["BrickColor"] = true, --same
  97. ["Disabled"] = true, --we have enabled property
  98. ["BackgroundColor"] = true, --brick color can break color3
  99. ["BorderColor"] = true, --same
  100. ["brickColor"] = true, --and again same
  101. }
  102.  
  103. local function getProperties(obj)
  104. if typeof(obj) ~= "Instance" then return end
  105. local ret = {}
  106. for i,_ in pairs(props[obj.ClassName]or props.Instance) do
  107. if dontSave[i] then continue end
  108. local s = pcall(function()
  109. ret[i] = obj[i]
  110. end)
  111. end
  112. return ret
  113. end
  114.  
  115. local function Find(String, Pattern)
  116. return String:find(Pattern, nil, true)
  117. end
  118.  
  119. local GlobalBasicSettings = UserSettings()
  120. local service = setmetatable({}, {
  121. __index = function(Self, Name)
  122. local Service = game:GetService(Name) or GlobalBasicSettings:GetService(Name)
  123. Self[Name] = Service
  124. return Service
  125. end,
  126. })
  127.  
  128. local EscapesPattern = "[%z\1-\8\11-\12\14-\31\127-\191\194-\244<>\"'&]"
  129. local Escapes = {
  130. ["<"] = "&lt;",
  131. [">"] = "&gt;",
  132. ['"'] = "&quot;",
  133. ["'"] = "&apos;",
  134. ["&"] = "&amp;",
  135. }
  136.  
  137. for rangeStart, rangeEnd in string.gmatch(EscapesPattern, "(.)%-(.)") do
  138. for charCode = string.byte(rangeStart), string.byte(rangeEnd) do
  139. Escapes[string.char(charCode)] = "&#" .. charCode .. ";"
  140. end
  141. end
  142.  
  143. local lookupValueToASCII = {} :: { [number]: number }
  144. local lookupASCIIToValue = {} :: { [number]: number }
  145.  
  146. local alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  147.  
  148. for index = 1, #alphabet do
  149. local value = index - 1
  150. local ascii = string.byte(alphabet, index)
  151.  
  152. lookupValueToASCII[value] = ascii
  153. lookupASCIIToValue[ascii] = value
  154. end
  155.  
  156. lookupASCIIToValue[string.byte("=")] = 0
  157.  
  158. local function buildStringFromCodes(values: { number }): string
  159. local chunks = {} :: { string }
  160.  
  161. for index = 1, #values, 4096 do
  162. table.insert(chunks, string.char(
  163. unpack(values, index, math.min(index + 4096 - 1, #values))
  164. ))
  165. end
  166.  
  167. return table.concat(chunks, "")
  168. end
  169.  
  170. local function encode(input: string): string
  171. local inputLength = #input
  172. local outputLength = math.ceil(inputLength / 3) * 4
  173.  
  174. local remainder = inputLength % 3
  175.  
  176. if remainder == 0 then
  177. input ..= string.char(0)
  178. end
  179.  
  180. local output = table.create(outputLength, 0) :: { number }
  181.  
  182. for chunkIndex = 0, (outputLength / 4) - (if remainder == 0 then 1 else 2) do
  183. local inputIndex = chunkIndex * 3 + 1
  184. local outputIndex = chunkIndex * 4 + 1
  185.  
  186. local chunk = bit32.rshift(string.unpack(">J", input, inputIndex), 8)
  187.  
  188. output[outputIndex] = lookupValueToASCII[bit32.rshift(chunk, 18)]
  189. output[outputIndex + 1] = lookupValueToASCII[bit32.band(bit32.rshift(chunk, 12), 0b111111)]
  190. output[outputIndex + 2] = lookupValueToASCII[bit32.band(bit32.rshift(chunk, 6), 0b111111)]
  191. output[outputIndex + 3] = lookupValueToASCII[bit32.band(chunk, 0b111111)]
  192. end
  193.  
  194. if remainder == 1 then
  195. local chunk = string.byte(input, inputLength)
  196.  
  197. output[outputLength - 3] = lookupValueToASCII[bit32.rshift(chunk, 2)]
  198. output[outputLength - 2] = lookupValueToASCII[bit32.band(bit32.lshift(chunk, 4), 0b111111)]
  199. output[outputLength - 1] = 61
  200. output[outputLength] = 61
  201. elseif remainder == 2 then
  202. local chunk = string.unpack(">H", input, inputLength - 1)
  203.  
  204. output[outputLength - 3] = lookupValueToASCII[bit32.rshift(chunk, 10)]
  205. output[outputLength - 2] = lookupValueToASCII[bit32.band(bit32.rshift(chunk, 4), 0b111111)]
  206. output[outputLength - 1] = lookupValueToASCII[bit32.band(bit32.lshift(chunk, 2), 0b111111)]
  207. output[outputLength] = 61
  208. end
  209.  
  210. return buildStringFromCodes(output)
  211. end
  212.  
  213. local function decode(input: string): string
  214. local inputLength = #input
  215. local outputLength = math.ceil(inputLength / 4) * 3
  216.  
  217. local padding = 0
  218. if string.byte(input, inputLength - 1) == 61 then
  219. padding = 2
  220. elseif string.byte(input, inputLength) == 61 then
  221. padding = 1
  222. end
  223.  
  224. local output = table.create(outputLength - padding, 0)
  225.  
  226. for chunkIndex = 0, (outputLength / 3) - 1 do
  227. local inputIndex = chunkIndex * 4 + 1
  228. local outputIndex = chunkIndex * 3 + 1
  229.  
  230. local value1, value2, value3, value4 = string.byte(input, inputIndex, inputIndex + 3)
  231.  
  232. local compound = bit32.bor(
  233. bit32.lshift(lookupASCIIToValue[value1], 18),
  234. bit32.lshift(lookupASCIIToValue[value2], 12),
  235. bit32.lshift(lookupASCIIToValue[value3], 6),
  236. lookupASCIIToValue[value4]
  237. )
  238.  
  239. output[outputIndex] = bit32.rshift(compound, 16)
  240. output[outputIndex + 1] = bit32.band(bit32.rshift(compound, 8), 0b11111111)
  241. output[outputIndex + 2] = bit32.band(compound, 0b11111111)
  242. end
  243.  
  244. if padding >= 1 then
  245. output[outputLength] = nil
  246.  
  247. if padding >= 2 then
  248. output[outputLength - 1] = nil
  249. end
  250. end
  251.  
  252. return buildStringFromCodes(output)
  253. end
  254.  
  255. local Base64_Encode = encode
  256.  
  257. local SharedStrings = {}
  258. local sharedstrings = setmetatable({
  259. identifier = 1e15
  260. }, {
  261. __index = function(self, String)
  262. local Identifier = self.identifier
  263. self.identifier = Identifier + 1
  264. Identifier = Base64_Encode(Identifier .. "")
  265. self[String] = Identifier
  266. return Identifier
  267. end,
  268. })
  269.  
  270. local Descriptors
  271. Descriptors = {
  272. __APIPRECISION = function(raw, default)
  273. if raw == 0 or raw % 1 == 0 then
  274. return raw
  275. end
  276.  
  277. local Extreme = Descriptors.__EXTREMIFY(raw)
  278. if Extreme then
  279. return Extreme
  280. end
  281.  
  282. local precision
  283. if type(default) == "string" then
  284. local dotIndex = Find(default, ".")
  285.  
  286. if dotIndex then
  287. precision = #default - dotIndex
  288. end
  289. else
  290. precision = default
  291. end
  292. if precision then
  293. return ("%." .. precision .. "f"):format(raw)
  294. end
  295.  
  296. return raw
  297. end,
  298. __BINARYSTRING = Base64_Encode,
  299. __BIT = function(...)
  300. local Value = 0
  301. local PackedArgs = { ... }
  302. for Index = 1, #PackedArgs do
  303. local Bit = PackedArgs[Index]
  304. if Bit then
  305. Value = Value + 2 ^ (Index - 1)
  306. end
  307. end
  308.  
  309. return Value
  310. end,
  311. __CDATA = function(raw)
  312. return "<![CDATA[" .. raw .. "]]>"
  313. end,
  314. __ENUM = function(raw)
  315. return raw.Value, "token"
  316. end,
  317. __ENUMNAME = function(raw)
  318. return raw.Name
  319. end,
  320. __EXTREMIFY = function(raw)
  321. local Extreme
  322. if raw ~= raw then
  323. Extreme = "NAN"
  324. elseif raw == math.huge then
  325. Extreme = "INF"
  326. elseif raw == -math.huge then
  327. Extreme = "-INF"
  328. end
  329.  
  330. return Extreme
  331. end,
  332. __PROTECTEDSTRING = function(raw)
  333. return Find(raw, "]]>") and Descriptors.string(raw) or Descriptors.__CDATA(raw)
  334. end,
  335. __VECTOR = function(X, Y, Z)
  336. local Value = "<X>" .. X .. "</X><Y>" .. Y .. "</Y>"
  337.  
  338. if Z then
  339. Value = Value .. "<Z>" .. Z .. "</Z>"
  340. end
  341.  
  342. return Value
  343. end,
  344. Axes = function(raw)
  345. return "<axes>" .. Descriptors.__BIT(raw.X, raw.Y, raw.Z) .. "</axes>"
  346. end,
  347. BrickColor = function(raw)
  348. return raw.Number, "BrickColor"
  349. end,
  350. CFrame = function(raw)
  351. local X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = raw:GetComponents()
  352. return Descriptors.__VECTOR(X, Y, Z)
  353. .. "<R00>"
  354. .. R00
  355. .. "</R00><R01>"
  356. .. R01
  357. .. "</R01><R02>"
  358. .. R02
  359. .. "</R02><R10>"
  360. .. R10
  361. .. "</R10><R11>"
  362. .. R11
  363. .. "</R11><R12>"
  364. .. R12
  365. .. "</R12><R20>"
  366. .. R20
  367. .. "</R20><R21>"
  368. .. R21
  369. .. "</R21><R22>"
  370. .. R22
  371. .. "</R22>",
  372. "CoordinateFrame"
  373. end,
  374. Color3 = function(raw)
  375. return "<R>" .. raw.R .. "</R><G>" .. raw.G .. "</G><B>" .. raw.B .. "</B>" -- ? It is recommended that Color3 is encoded with elements instead of text.
  376. end,
  377. ColorSequence = function(raw)
  378. local Converted = ""
  379. local Keypoints = raw.Keypoints
  380. for Index = 1, #Keypoints do
  381. local v = Keypoints[Index]
  382. local Value = v.Value
  383. Converted = Converted .. v.Time .. " " .. Value.R .. " " .. Value.G .. " " .. Value.B .. " 0 " -- * " 0" is Envelope: Has the range 0 - 1. Currently unused by Roblox.
  384. end
  385.  
  386. return Converted
  387. end,
  388. Content = function(raw)
  389. return raw == "" and "<null></null>" or "<url>" .. Descriptors.string(raw, true) .. "</url>"
  390. end,
  391. CoordinateFrame = function(raw)
  392. return "<CFrame>" .. Descriptors.CFrame(raw) .. "</CFrame>"
  393. end,
  394. Faces = function(raw)
  395. return "<faces>"
  396. .. Descriptors.__BIT(raw.Right, raw.Top, raw.Back, raw.Left, raw.Bottom, raw.Front)
  397. .. "</faces>"
  398. end,
  399. Font = function(raw)
  400. return "<Family>"
  401. .. Descriptors.Content(raw.Family)
  402. .. "</Family><Weight>"
  403. .. Descriptors.__ENUM(raw.Weight)
  404. .. "</Weight><Style>"
  405. .. Descriptors.__ENUMNAME(raw.Style)
  406. .. "</Style>" --TODO:
  407. end,
  408. NumberRange = function(raw)
  409. return raw.Min .. " " .. raw.Max
  410. end,
  411. NumberSequence = function(raw)
  412. local Converted = ""
  413. local Keypoints = raw.Keypoints
  414. for Index = 1, #Keypoints do
  415. local v = Keypoints[Index]
  416. Converted = Converted .. v.Time .. " " .. v.Value .. " " .. v.Envelope .. " "
  417. end
  418.  
  419. return Converted
  420. end,
  421. PhysicalProperties = function(raw)
  422. local CustomPhysics
  423. if raw then
  424. CustomPhysics = true
  425. else
  426. CustomPhysics = false
  427. end
  428. CustomPhysics = "<CustomPhysics>" .. Descriptors.bool(CustomPhysics) .. "</CustomPhysics>"
  429.  
  430. return raw
  431. and CustomPhysics .. "<Density>" .. raw.Density .. "</Density><Friction>" .. raw.Friction .. "</Friction><Elasticity>" .. raw.Elasticity .. "</Elasticity><FrictionWeight>" .. raw.FrictionWeight .. "</FrictionWeight><ElasticityWeight>" .. raw.ElasticityWeight .. "</ElasticityWeight>"
  432. or CustomPhysics
  433. end,
  434. Ray = function(raw)
  435. local vector3 = Descriptors.Vector3
  436.  
  437. return "<origin>" .. vector3(raw.Origin) .. "</origin><direction>" .. vector3(raw.Direction) .. "</direction>"
  438. end,
  439. Rect = function(raw)
  440. local vector2 = Descriptors.Vector2
  441.  
  442. return "<min>" .. vector2(raw.Min) .. "</min><max>" .. vector2(raw.Max) .. "</max>", "Rect2D"
  443. end,
  444. SharedString = function(raw)
  445. raw = Base64_Encode(raw)
  446.  
  447. local Identifier = sharedstrings[raw]
  448.  
  449. if SharedStrings[Identifier] == nil then
  450. SharedStrings[Identifier] = raw
  451. end
  452.  
  453. return Identifier
  454. end,
  455. UDim = function(raw)
  456. return "<S>" .. raw.Scale .. "</S><O>" .. raw.Offset .. "</O>"
  457. end,
  458. UDim2 = function(raw)
  459. local X, Y = raw.X, raw.Y
  460.  
  461. return "<XS>"
  462. .. X.Scale
  463. .. "</XS><XO>"
  464. .. X.Offset
  465. .. "</XO><YS>"
  466. .. Y.Scale
  467. .. "</YS><YO>"
  468. .. Y.Offset
  469. .. "</YO>"
  470. end,
  471. Vector2 = function(raw)
  472. return Descriptors.__VECTOR(raw.X, raw.Y)
  473. end,
  474. Vector2int16 = function(raw)
  475. return Descriptors.__VECTOR(raw.X, raw.Y)
  476. end,
  477. Vector3 = function(raw)
  478. return Descriptors.__VECTOR(raw.X, raw.Y, raw.Z)
  479. end,
  480. Vector3int16 = function(raw)
  481. return Descriptors.__VECTOR(raw.X, raw.Y, raw.Z)
  482. end,
  483. bool = function(raw)
  484. return tostring(raw)
  485. end,
  486. double = function(raw, default)
  487. return Descriptors.__APIPRECISION(raw, default or 17)
  488. end,
  489. float = function(raw, default)
  490. return Descriptors.__APIPRECISION(raw, default or 9)
  491. end,
  492. string = function(raw, skipcheck)
  493. return not skipcheck and raw == "" and raw or raw:gsub(EscapesPattern, Escapes)
  494. end,
  495. }
  496.  
  497. local msbn = (2^31)-1
  498. local maxDouble = 1.79e+308
  499. local maxFloat = 3.402823466e+38
  500.  
  501. local function getType(obj)
  502. if typeof(obj) == "BrickColor" then
  503. return "Color3"
  504. elseif typeof(obj) == "string" then
  505. local protectedStr = 200000
  506. if #obj == protectedStr or #obj >= protectedStr then
  507. return "ProtectedString"
  508. else
  509. return "string"
  510. end
  511. elseif typeof(obj) == "number" then
  512. local strObj = tostring(obj)
  513. local obj = math.abs(obj)
  514. if strObj:match("%.") or obj >= maxDouble or obj == maxDouble then
  515. return "double"
  516. elseif (obj == maxFloat or obj <= maxFloat) and obj >= msbn then
  517. return "float"
  518. else
  519. return "number"
  520. end
  521. elseif typeof(obj) == "EnumItem" then
  522. return "__ENUM"
  523. else
  524. return tostring(Descriptors["__"..typeof(obj):upper()] and "__"..typeof(obj):upper() or typeof(obj))
  525. end
  526. end
  527.  
  528. local function parseType(obj)
  529. if typeof(obj) == "BrickColor" then
  530. return Descriptors.Color3(obj.Color)
  531. elseif typeof(obj) == "string" then
  532. local protectedStr = 200000
  533. if #obj == protectedStr or #obj >= protectedStr then
  534. return Descriptors.__PROTECTEDSTRING(obj)
  535. else
  536. return Descriptors.string(obj,false)
  537. end
  538. elseif typeof(obj) == "number" then
  539. local strObj = tostring(obj)
  540. local obj = math.abs(obj)
  541. if strObj:match("%.") or obj >= maxDouble or obj == maxDouble then
  542. return Descriptors.double(strObj)
  543. elseif (obj == maxFloat or obj <= maxFloat) and obj >= msbn then
  544. return Descriptors.float(strObj)
  545. else
  546. return strObj
  547. end
  548. elseif typeof(obj) == "EnumItem" then
  549. return Descriptors.__ENUM(obj)
  550. else
  551. return Descriptors[typeof(obj)] and Descriptors[typeof(obj)](obj) or Descriptors["__"..typeof(obj):upper()] and Descriptors["__"..typeof(obj):upper()] or tostring(obj)
  552. end
  553. end
  554.  
  555. local function parseProperty(obj,propName,type)
  556. local type = type or getType(obj)
  557. if type == "ProtectedString" then
  558. return "<ProtectedString name="..propName.."\"><![CDATA[--[["..obj.."]]]]></ProtectedString>"
  559. else
  560. return "<"..type.." name=\""..propName.."\">"..parseType(obj).."</"..type..">"
  561. end
  562. end
  563.  
  564. local added = {}
  565.  
  566. local ref = -1
  567. function parseInstance(obj,options)
  568. if typeof(obj) ~= "Instance" then return "" end
  569. if not options.SaveCharacters and game.Players:GetPlayerFromCharacter(obj) then return "" end
  570.  
  571. ref += 1
  572. local startStr = "<Item class=\""..obj.ClassName.."\" referent=\"RBX"..ref.."\"><Properties>"
  573. local midStr = "</Properties>"
  574. local endStr = "</Item>"
  575.  
  576. local props
  577. if table.find(added,obj) then
  578. props = obj:GetAttributes()
  579. else
  580. props = getProperties(obj)
  581. end
  582.  
  583. local ignored = typeof(options.DecompileIgnore) == "table" and (table.find(options.DecompileIgnore,obj) or options.DecompileIgnore[obj]) or typeof(options.DecompileIgnore) ~= "table" or table.find(tpData,script) or tpData[script]
  584. ignored = ignored or obj == script
  585. if not ignored then
  586. for i,v in pairs(options.DecompileIgnore) do
  587. if typeof(i) == "Instance" then
  588. ignored = ignored or obj:IsDescendantOf(i)
  589. elseif typeof(v) == "Instance" then
  590. ignored = ignored or obj:IsDescendantOf(v)
  591. end
  592. end
  593. end
  594.  
  595. local saveignored = typeof(options.SaveIgnore) == "table" and (table.find(options.SaveIgnore,obj) or options.SaveIgnore[obj]) or typeof(options.SaveIgnore) ~= "table"
  596. if not saveignored then
  597. for i,v in pairs(options.SaveIgnore) do
  598. if typeof(i) == "Instance" then
  599. ignored = ignored or obj:IsDescendantOf(i)
  600. elseif typeof(v) == "Instance" then
  601. ignored = ignored or obj:IsDescendantOf(v)
  602. end
  603. end
  604. end
  605. if saveignored then return "" end
  606.  
  607. if obj:IsA("LuaSourceContainer") and options.Decompile and not ignored then
  608. props.Source = _G.ENV.decompile(obj)
  609. elseif not options.Decompile then
  610. props.Source = "--Decompiling is disabled."
  611. elseif ignored then
  612. if game.PlaceId == 15996884310 then
  613. props.Source = "return true"
  614. else
  615. props.Source = "--The script has been ignored."
  616. end
  617. end
  618.  
  619. local parsedProps = {}
  620. for i,v in pairs(props) do
  621. parsedProps[#parsedProps+1] = parseProperty(v,i,i=="Source"and"ProtetedString"or nil)
  622. end
  623.  
  624. local parsed = startStr..table.concat(parsedProps)..midStr
  625.  
  626. local children = obj:GetChildren()
  627.  
  628. local parsedChildren = {}
  629. for i,v in pairs(children) do
  630. parsedChildren[i] = parseInstance(v,options)
  631. task.wait()
  632. end
  633. return parsed..table.concat(parsedChildren)..endStr
  634. end
  635.  
  636. local function addObject(obj,parent,props)
  637. local i
  638. pcall(function()
  639. i = Instance.new(obj,parent)
  640. end)
  641. if not i then return end
  642. for idx,val in pairs(props) do
  643. i:SetAttribute(idx,val)
  644. end
  645. table.insert(added,i)
  646. end
  647. local function moveObject(obj,par)
  648. if not obj or not par then return end
  649. if par:FindFirstChild(obj.Name) then return end
  650. local clone = obj:Clone()
  651. clone.Parent = par
  652. clone.Name = obj.Name
  653. table.insert(added,clone)
  654. end
  655. local function finish()
  656. if #added == 0 then return end
  657. for i,v in pairs(added) do
  658. if v then
  659. v:Destroy()
  660. end
  661. end
  662. added = {}
  663. end
  664.  
  665. local saveServices = {
  666. ["Workspace"]=true,
  667. ["Lighting"]=true,
  668. ["MaterialService"]=true,
  669. ["ReplicatedFirst"]=true,
  670. ["ReplicatedStorage"]=true,
  671. ["StarterGui"]=true,
  672. ["StarterPack"]=true,
  673. ["StarterPlayer"]=true,
  674. ["Teams"]=true,
  675. ["SoundService"]=true,
  676. ["VoiceChatService"]=true
  677. }
  678.  
  679. local function saveinstance(inst,options)
  680. local options = typeof(options) == "table" and options or {}
  681. local function checkOption(name,def)
  682. if options[name] == nil then
  683. options[name] = def
  684. end
  685. end
  686.  
  687. checkOption("Decompile",true)
  688. if game.PlaceId == 15996884310 then
  689. checkOption("DecompileIgnore",{})
  690. end
  691. checkOption("SaveIgnore",{})
  692. table.insert(options.DecompileIgnore, game.ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents"))
  693. table.insert(options.DecompileIgnore, workspace.CurrentCamera)
  694. checkOption("SaveCharacters",false)
  695.  
  696. --
  697.  
  698. local startStr = "<roblox version=\"4\">"
  699. local endStr = "</roblox>"
  700. ref = 0
  701. if inst == game or not inst then
  702. for i,v in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
  703. if v and v.Name ~= "Chat" then
  704. moveObject(v,game.StarterGui)
  705. end
  706. end
  707. addObject("Script",game,{Source = "--Thanks for using ".._G.ENV.identifyexecutor().."'s saveinstance!\10--The game was saved with that options:\10\10"..game.HttpService:JSONEncode(options).."\10\10script:Destroy()", RunContext = Enum.RunContext.Server})
  708. local gen = ""
  709. for i,v in pairs(typeof(options.SaveServices) == "table" and options.SaveServices or game:GetChildren()) do
  710. if not v or not table.pack(pcall(function()v:GetChildren()end))[1] or not saveServices[v.ClassName] then continue end
  711. gen = gen..parseInstance(v,options)
  712. task.wait()
  713. end
  714. finish()
  715. return startStr..gen..endStr
  716. else
  717. local done = parseInstance(inst)
  718. finish()
  719. return done
  720. end
  721. end
  722.  
  723. local function tween(a,b,c)
  724. coroutine.wrap(function()
  725. local ts = game.TweenService:Create(a,b,c)
  726. ts:Play()
  727. task.wait(0.1+b.Time)
  728. pcall(function()
  729. ts:Destroy()
  730. end)
  731. end)()
  732. end
  733.  
  734. local function vulkanSaveinstance(...)
  735. local args = table.pack(...)
  736. local method = args[1]
  737. if typeof(method) == "string" and method:lower() == "gui" then
  738. return
  739. elseif typeof(method) == "Instance" or typeof(method) == "nil" then
  740. local options = typeof(args[2]) == "table" and args[2] or {}
  741. local gui = Instance.new("ScreenGui",_G.ENV.gethui())
  742. gui.DisplayOrder = maxFloat
  743. gui.Name = "SaveinstanceGui"
  744. gui.ResetOnSpawn = false
  745. local tl = Instance.new("TextLabel",gui)
  746. tl.BackgroundTransparency = 1
  747. local fileName = (options.FileName or game.PlaceId)..".rbxl"
  748. tl.Text = "Saving "..fileName
  749. tl.Size = UDim2.fromScale(0.5,0.05)
  750. tl.AnchorPoint = Vector2.new(0.5,0.5)
  751. tl.Position = UDim2.fromScale(0.5,0.775)
  752. tl.TextScaled = true
  753. tl.TextColor3 = Color3.fromRGB(255,85,0)
  754. tl.TextStrokeTransparency = 1
  755. tl.TextTransparency = 1
  756. tween(tl,TweenInfo.new(0.1),{TextTransparency = 0, TextStrokeTransparency = 0})
  757. local startTime = os.time()
  758. local res = saveinstance(...)
  759. local endTime = os.time()
  760. local time = endTime-startTime
  761. if typeof(res) == "string" then
  762. tl.Text = "Saved as "..fileName.." in "..time.." seconds!\10Run _G.FileExplorer() and search for \""..fileName.."\" in it."
  763. _G.ENV.writefile(game.PlaceId..".rbxl", res)
  764. task.wait((time/10)+5)
  765. tween(tl,TweenInfo.new(1),{TextTransparency = 1, TextStrokeTransparency = 1})
  766. task.wait(1.1)
  767. gui:Destroy()
  768. return res
  769. else
  770. tl.Text = "Failed to save file "..fileName
  771. task.wait((time/10)+5)
  772. tween(tl,TweenInfo.new(1),{TextTransparency = 1, TextStrokeTransparency = 1})
  773. task.wait(1.1)
  774. gui:Destroy()
  775. return "Failed"
  776. end
  777. else
  778. error("Argument 1: Unknown saveinstance method!")
  779. end
  780. end
  781.  
  782. return vulkanSaveinstance
Add Comment
Please, Sign In to add comment