Advertisement
tyridge77

FunTestThing

Feb 13th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. local url = "http://pastebin.com/raw/g8SXwWxE";
  2. local search = "http://google.com/search?q=&ARG&+in+hex&oq=16777215+in+hex&aqs=chrome..69i57.6678j0j7&sourceid=chrome&es_sm=93&ie=UTF-8";
  3.  
  4. local http = game:GetService("HttpService");
  5. local raw = http:GetAsync(url);
  6. local Data = {};
  7.  
  8. local width = 105;
  9. local height = 65;
  10.  
  11. for a,b,c in raw:gmatch("%((.-)%)%((.-)%)%((.-)%)|") do
  12.    Data[#Data+1]={x=a,y=b,dat=c}
  13. end
  14.  
  15.  
  16. function hexToRGB(hex)
  17.     if(string.len(hex) == 3) then hex = hex .. hex end
  18.     if(string.len(hex) ~= 6) then return Color3.new(1, 1, 1) end
  19.    
  20.     local r = tonumber(string.sub(hex, 1, 2), 16)
  21.     local g = tonumber(string.sub(hex, 3, 4), 16)
  22.     local b = tonumber(string.sub(hex, 5, 6), 16)
  23.    
  24.     if not r or not g or not b then return Color3.new(1, 1, 1) end
  25.     r=r/255;
  26.     g=g/255;
  27.     b=b/255;
  28.    return r,g,b
  29. end
  30. function tohex(num)
  31. local hexstr = '0123456789abcdef'
  32. local s = '';
  33. while num > 0 do
  34. local mod = math.fmod(num,16)
  35. s = string.sub(hexstr,mod+1,mod+1)..s
  36. num = math.floor(num/16)
  37. end
  38. if s == '' then s = '0' end
  39. return s
  40. end
  41.  
  42. local Group = Instance.new("Model",Workspace);
  43. for i = 1,#Data,1 do
  44.   local data = Data[i];
  45.   local x,y = data.x,data.y;
  46.   local argb = data.dat:gsub("%-","");
  47.   red,green,blue = hexToRGB(tohex(tonumber(argb)));
  48.   local part = Instance.new("Part",Group);
  49.   part.Material = "SmoothPlastic";
  50.   part.FormFactor = "Custom";
  51.   part.Size=Vector3.new(1,1,1);
  52.   part.Anchored = true;
  53.   part.CFrame = CFrame.new(x,100-y,0);
  54.   part.BrickColor = BrickColor.new(Color3.new(red,green,blue));
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement