Advertisement
danyal215977

SetroStudio Autobuilder (Not RetroStudio!)

Apr 25th, 2023 (edited)
3,194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.54 KB | None | 0 0
  1. print("all owned by Childx AKA SynChild Server!")
  2. print("only works for SetroStudio not retro studio kids!")
  3. local CoreGui = game:GetService("CoreGui")
  4. local UIS = game:GetService('UserInputService')
  5. local HttpService = game:GetService("HttpService")
  6. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  7. local vu = game:GetService("VirtualUser")
  8. local Players = game:GetService("Players")
  9. local Player = Players.LocalPlayer
  10.  
  11. if game.PlaceId ~= 13233904225 then
  12.     local message = Instance.new('Message', workspace)
  13.     message.Text = "Hey, you're in the wrong place. This only works in studio mode."
  14.     return
  15. end
  16. do
  17.     local OldUI = CoreGui:FindFirstChild("AutoBuildGui")
  18.     if OldUI then
  19.         OldUI:Destroy()
  20.     end
  21. end
  22.  
  23. warn('\n\n\n\n\nThanks for using RetroStudio Auto Build by discord.gg/FloofyPlasma! \n\n\nPress the insert key to toggle the UI. KNOW ITS NOT FOR RETRO STUDIO ITS FOR FRICKING SETROSTUDIO')
  24.  
  25. local RemoteFunctions = ReplicatedStorage.RemoteFunctions
  26. local RemoteEvents = ReplicatedStorage.RemoteEvents
  27.  
  28. local CreateObjectEvent = RemoteFunctions.CreateObject
  29. local ObjectPropertyChangeRequestEvent = RemoteFunctions.ChangeObjectPropertyAndReturn
  30. local CheckpointEvent = RemoteEvents.ChangeHistoryInteractionRequested
  31.  
  32. local AutoBuildGui, MainFrame, TitleLabel, ModelBox, NameBox, StartButton, CompletedSound = loadstring(game:HttpGet("https://raw.githubusercontent.com/FloofyPlasma/RetroStudio-Auto-Build/main/UI.lua"))()()
  33. local Properties = loadstring(game:HttpGet("https://raw.githubusercontent.com/FloofyPlasma/RetroStudio-Auto-Build/main/Properties.lua"))()
  34. local HashLib = require(ReplicatedStorage:WaitForChild('HashLib'))
  35.  
  36. local CreatedInstances = 0
  37.  
  38. local function Hash(Time)
  39.     return HashLib.md5((("%*\224\182\158"):format(Time)))
  40. end
  41.  
  42. local function CreateNewInstance(ClassName, Parent)
  43.     local Time = os.time()
  44.     local Success, Result = pcall(CreateObjectEvent.InvokeServer, CreateObjectEvent, ClassName, Parent, Hash(Time), Time)
  45.     CreatedInstances = CreatedInstances + 1
  46.  
  47.     if not Success then
  48.         warn(Result)
  49.     end
  50.  
  51.     return Result
  52. end
  53.  
  54. local function SetInstanceProperty(Object, PropertyName, NewValue)
  55.     ObjectPropertyChangeRequestEvent:InvokeServer(Object, PropertyName, NewValue)
  56. end
  57.  
  58. local function ScanModel(Model, ServerParent)
  59.     if not ServerParent then
  60.         ServerParent = CreateNewInstance(Model.ClassName, workspace)
  61.         task.spawn(SetInstanceProperty, ServerParent, "Name", Model.Name)
  62.     end
  63.  
  64.     for _,Child in ipairs(Model:GetChildren()) do
  65.         --task.spawn(function()
  66.             local Properties = Properties[Child.ClassName]
  67.            
  68.             if not Properties then
  69.                 continue
  70.             end
  71.  
  72.             local NewObject = CreateNewInstance(Child.ClassName, ServerParent)
  73.             local IsAnchored = Child:GetAttribute("Anchored")
  74.  
  75.             if IsAnchored ~= nil then
  76.                 Child.Anchored = IsAnchored
  77.             end
  78.  
  79.             if Child:IsA("BasePart") then
  80.                 SetInstanceProperty(NewObject, "FormFactor", "Custom")
  81.             end
  82.  
  83.             for _,Property in ipairs(Properties) do
  84.                 SetInstanceProperty(NewObject, Property, Child[Property])
  85.             end
  86.  
  87.             if IsAnchored ~= nil then
  88.                 Child.Anchored = true
  89.             end
  90.  
  91.             ScanModel(Child, NewObject)
  92.         --end)
  93.     end
  94. end
  95.  
  96. local function GetAssets(AssetId)
  97.     local Model = game:GetObjects("rbxassetid://"..AssetId)
  98.  
  99.     if not Model then return end
  100.  
  101.     Model = Model[1]
  102.  
  103.     for _,Object in ipairs(Model:GetDescendants()) do
  104.         pcall(function()
  105.             Object:SetAttribute("Anchored", Object.Anchored)
  106.             Object.Anchored = true
  107.         end)
  108.     end
  109.  
  110.     return Model
  111. end
  112.  
  113. local function Start(AssetId, ModelName)
  114.     local Model = GetAssets(AssetId)
  115.  
  116.     if not Model then return end
  117.  
  118.     Model.Name = ModelName
  119.     local StartTime = tick()
  120.     CreatedInstances = 0
  121.     warn('\n\n\nStarting! This may take a while depending on the size of your model.\n\n\nPlease be patient thanks :3\n\n\n')
  122.     --SetCheckpoint()
  123.     ScanModel(Model)
  124.     --SetCheckpoint()
  125.     CompletedSound:Play()
  126.     warn('\n\n\nFinished! Took ' .. tick() - StartTime .. ' seconds to create '.. tostring(CreatedInstances) .. ' instances.\n\n\n')
  127.     Model:Destroy()
  128. end
  129.  
  130. local function Init()
  131.     local AssetId = tonumber(ModelBox.Text) or 0
  132.     local ModelName = tostring(NameBox.Text) or 'Model'
  133.     Start(AssetId, ModelName)
  134. end
  135.  
  136. StartButton.Activated:Connect(Init)
  137.  
  138. UIS.InputBegan:Connect(function(Input)
  139.     if Input.KeyCode == Enum.KeyCode.Insert then
  140.         AutoBuildGui.Enabled = not AutoBuildGui.Enabled
  141.     end
  142. end)
  143.  
  144. Player.Idled:Connect(function()
  145.    vu:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  146.    task.wait(1)
  147.    vu:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
  148. end)
  149.  
  150. return {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement