Advertisement
Axprotss

Must fix this

Aug 15th, 2022
1,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 244.98 KB | Gaming | 0 0
  1.  
  2. local newUI = Instance.new('ScreenGui', script)
  3. local newTextBox = Instance.new('TextBox', newUI)
  4. local event = Instance.new("RemoteEvent",script)
  5.  
  6.  
  7. local http = game:GetService("HttpService""png" then
  8.         return warn("[IMAGE RENDER V2]: Image must be a png!")
  9.     end
  10.     local requestedImage = http:GetAsync(urlToRender)
  11.     print(requestedImage)
  12. end
  13.  
  14. function renderFromJSON(jsonTable)
  15.     local decodedJSON = http:JSONDecode(jsonTable)
  16.     local x = 1
  17.     local y = 1
  18.     local curX = 1
  19.     local skipAmount = 0
  20.     local needToRepeatX = 103
  21.  
  22.     local startY = owner.Character.HumanoidRootPart.Position.Y
  23.     local startX = owner.Character.HumanoidRootPart.Position.X
  24.  
  25.     local start = os.time()
  26.  
  27.     for i=1,102 do
  28.         curX=1
  29.         y = y+1
  30.         for i=1,needToRepeatX do
  31.             curX = i
  32.  
  33.             local foundColor = false
  34.             local chosenColorTable = nil
  35.             local newPixel = Instance.new("Part")
  36.             newPixel.Position = Vector3.new((startX+curX),startY,y)
  37.  
  38.             for _, pixelColor in pairs(jsonTable) do
  39.                 if jsonTable[_][4] == curX and jsonTable[_][5] == y-1 then
  40.                     chosenColorTable = pixelColor
  41.                     newPixel.BrickColor = BrickColor.new(Color3.fromRGB(pixelColor[1], pixelColor[2], pixelColor[3]))
  42.                     newPixel.Size = Vector3.new(1,1,1)
  43.                     foundColor = true
  44.                 end      
  45.             end
  46.  
  47.             if foundColor == false then newPixel.Transparency = 1 end
  48.  
  49.             --[[
  50.             if foundColor == false then newPixel.Transparency = 1 else
  51.                 for _, pixelColor in pairs(jsonTable) do
  52.                     if pixelColor[1] == chosenColorTable[1] and pixelColor[2] == chosenColorTable[2] and pixelColor[3] == chosenColorTable[3] then
  53.                         skipAmount = skipAmount+1
  54.                         needToRepeatX = needToRepeatX-1
  55.                         curX=curX+1
  56.                         newPixel.Size = Vector3.new(1+skipAmount,1,1)
  57.                         newPixel.Position = Vector3.new((startX+curX)+1,startY,y)
  58.                     else
  59.                         break
  60.                     end            
  61.                 end
  62.             end        
  63.             --]]
  64.             newPixel.Material = Enum.Material.SmoothPlastic
  65.             newPixel.Anchored = true
  66.             --newPixel.Position = Vector3.new((startX+curX)-(skipAmount),startY,y)
  67.  
  68.             newPixel.Parent = script
  69.             task.wait(0.0375)
  70.             x = x+1
  71.         end
  72.     end
  73.     print("Done! It took ".. start-os.time().. " seconds!")
  74. end
  75.  
  76. owner.Chatted:Connect(function(m)
  77.     if m:sub(1,2):lower() == "#r" then
  78.         renderFromJSON(torenderJSON)
  79.     end
  80. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement