Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local http = game:GetService("HttpService""png" then
- return warn("[IMAGE RENDER V2]: Image must be a png!")
- end
- local requestedImage = http:GetAsync(urlToRender)
- print(requestedImage)
- end
- function renderFromJSON(jsonTable)
- local decodedJSON = http:JSONDecode(jsonTable)
- local x = 1
- local y = 1
- local curX = 1
- local skipAmount = 0
- local needToRepeatX = 27
- local startY = owner.Character.HumanoidRootPart.Position.Y
- local startX = owner.Character.HumanoidRootPart.Position.X
- local start = os.time()
- for i=1,35 do
- curX=1
- y = y+1
- needToRepeatX=27
- for i=1,needToRepeatX do
- curX = i
- local foundColor = false
- local chosenColorTable = nil
- local newPixel = Instance.new("Part")
- newPixel.Position = Vector3.new((startX+curX),startY,y)
- for _, pixelColor in pairs(jsonTable) do
- if jsonTable[_][4] == curX and jsonTable[_][5] == y-1 then
- chosenColorTable = pixelColor
- newPixel.BrickColor = BrickColor.new(Color3.fromRGB(pixelColor[1], pixelColor[2], pixelColor[3]))
- newPixel.Size = Vector3.new(2,1,1)--here
- foundColor = true
- end
- end
- if foundColor == false then newPixel.Transparency = 1 end
- --[[
- if foundColor == false then newPixel.Transparency = 1 else
- for _, pixelColor in pairs(jsonTable) do
- if pixelColor[1] == chosenColorTable[1] and pixelColor[2] == chosenColorTable[2] and pixelColor[3] == chosenColorTable[3] then
- skipAmount = skipAmount+1
- needToRepeatX = needToRepeatX-1
- curX=curX+1
- newPixel.Size = Vector3.new(1+skipAmount,1,1)
- newPixel.Position = Vector3.new((startX+curX)+1,startY,y)
- else
- break
- end
- end
- end
- --]]
- newPixel.Material = Enum.Material.SmoothPlastic
- newPixel.Anchored = true
- --newPixel.Position = Vector3.new((startX+curX)-(skipAmount),startY,y)
- newPixel.Parent = workspace
- task.wait(0.0375)
- x = x+1
- end
- end
- print("Done! It took ".. start-os.time().. " seconds!")
- end
- owner.Chatted:Connect(function(m)
- if m:sub(1,2):lower() == "#r" then
- renderFromJSON(torenderJSON)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement