aweeb

Untitled

Feb 16th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | None | 0 0
  1. --<insert credit here that will be deleted anyway>
  2. --Converted string size:242
  3.  
  4. local Scripts = {function() wait(1)
  5. local sp = script.Parent
  6. local cam = sp.Camera
  7. local gui = sp.Part.SurfaceGui
  8. --[[
  9. local function pixelAt(c3,x,y)
  10. local f = Instance.new("Frame",gui)
  11. f.Size = UDim2.new(0,1,0,1)
  12. f.BorderSizePixel = 0
  13. f.BackgroundColor3 = c3
  14. f.Position = UDim2.new(0,x,0,y)
  15. return f
  16. end
  17. ]]
  18.  
  19. local function sl(a,n) --Shift left by n bytes
  20. return math.floor(a*(2^n))
  21. end
  22. local function sr(a,n) --Shift right by n bytes
  23. return math.floor(a/(2^n))
  24. end
  25.  
  26. local Colors = {}
  27. local Pixels = setmetatable({},{
  28. __index=
  29. function(self,i)
  30. local t = {}
  31. self[i] = t
  32. return t
  33. end
  34. })
  35. local function FindOrInsert(t,c)
  36. for i,v in pairs(t) do if v==c then return i end end
  37. table.insert(t,c)
  38. return #t
  39. end
  40. local function c3val(c3)
  41. return sl(c3.r*255,16)+sl(c3.g*255,8)+math.floor(c3.b*255)
  42. end
  43. local function valtoc3(int)
  44. return Color3.fromRGB(sr(int,16),sr(int,8)%256,int%256)
  45. end
  46. local function pixelAt(c3,x,y)
  47. local i = FindOrInsert(Colors,c3val(c3))
  48. Pixels[y][x] = i
  49. end
  50.  
  51. local function rayColor(ray)
  52. local hit,pos,normal = workspace:FindPartOnRay(ray,sp)
  53. local distance = (ray.Origin-pos).magnitude
  54. if hit then
  55. -- local p = Instance.new("Part")
  56. -- p.Anchored = true
  57. -- p.CanCollide = false
  58. -- p.Size = Vector3.new(0.05, 0.05, distance)
  59. -- p.CFrame = CFrame.new(ray.Origin, pos) * CFrame.new(0, 0, -distance / 2)
  60. -- p.Parent = sp
  61. return hit.Color
  62. else
  63. return Color3.new(0,0,0)
  64. end
  65. end
  66.  
  67. local cs = gui.CanvasSize
  68. local t = tick()
  69. for y=0,cs.Y-1 do
  70. --wait()
  71. for x=0,cs.X-1 do
  72. local a,b = ((x/(cs.X-1))*2)-1,((y/(cs.Y-1))*-2)+1
  73. local v = (cam.CFrame*CFrame.new(a*5,b*5,5)).p
  74. local ray = Ray.new(cam.CFrame.p,(cam.CFrame.p-v).Unit*100)
  75. local c3 = rayColor(ray)
  76. pixelAt(c3,cs.X-1-x,cs.Y-1-y)
  77. end
  78. end
  79. print(tick()-t)
  80.  
  81. local str = ""
  82. local lastint = -1
  83. local n = -1
  84. local aa=0
  85. local function addNum(n)
  86. str = str..string.char(n)
  87. end
  88. for y=0,cs.Y-1 do
  89. for x=0,cs.X-1 do
  90. local i = Pixels[y][x]
  91. aa=aa+1
  92. if i~=lastint and lastint~=-1 or n>254 then
  93. addNum(lastint)
  94. addNum(n)
  95. --print(n)
  96. n = 0
  97. end
  98. n = n+1
  99. lastint = i
  100. end
  101. end
  102. print(aa,cs.X*cs.Y)
  103. local x,y = -1,0
  104. print(#str)
  105. aa=0
  106. for i=1,#str,2 do
  107. local clr,n = Colors[string.byte(str:sub(i,i))],string.byte(str:sub(i+1,i+1))
  108. aa=aa+n
  109. --print(n)
  110. for i=1,n do
  111. x = x+1
  112. if x>=cs.X then
  113. x=x-cs.X
  114. y=y+1
  115. end
  116. local f = Instance.new("Frame",gui)
  117. f.Size = UDim2.new(0,1,0,1)
  118. f.BackgroundColor3 = valtoc3(clr)
  119. f.BorderSizePixel = 0
  120. f.Position = UDim2.new(0,x,0,y)
  121. end
  122. end
  123. print(aa) end;}
  124. local ActualScripts = {}
  125. function s(var)
  126. local func = table.remove(Scripts,1)
  127. local env = getfenv(func)
  128. local newenv = setmetatable({},{
  129. __index = function(self,k)
  130. if k=="script" then
  131. return var
  132. else
  133. return env[k]
  134. end
  135. end,
  136. })
  137. setfenv(func,newenv)
  138. table.insert(ActualScripts,coroutine.wrap(func))
  139. end
  140. function Decode(a,b,c,d,e,f,g,h,i,j)local k,l,m,n,o,p=tonumber,table.remove,table.foreach,Instance.new,"Parent",","i=function(a,q,r)r={}a:gsub(("([^%s]+)"):format(q),function(t)r[#r+1]=t end)return r end;j=function(b)return i(l(b,1),p)end;b=i(a,";")c=j(b)d=j(b)e=j(b)f=n"Model"g=f;m(b,function(u,t)if t=="n"or t=="p"then g=t=="n"and h or g[o]else u=i(t,"|")h=n(d[k(l(u,1))])if h:IsA"BasePart"then h.Anchored=true;h.Locked=true elseif h:IsA"Script"then s(h)end;m(u,function(s,v,w,a)w=v:find":"v,a=c[k(v:sub(1,w-1))],v:sub(w+1)function w(w)return unpack(i(w,p))end;s=#i(a,p)h[v]=v=="Name"and e[k(a)]or(v=="Color"or v:sub(#v-5)=="Color3")and s==3 and Color3.new(w(a))or s==4 and UDim2.new(w(a))or s==3 and Vector3.new(w(a))or s==2 and Vector2.new(w(a))or s==12 and CFrame.new(w(a))or k(a)or a~="true"and a~="false"and a or a=="true"end)h[o]=g end end)return f end
  141.  
  142. local Model = Decode([==[Name,Color,Position,Orientation,Size,Face,ClipsDescendants,CanvasSize;Part,SurfaceGui,Script;Camera;1|1:1|2:0.067,0.067,0.067|3:25,5,-47|4:0,180,0|5:2,2,2;1|2:0.973,0.973,0.973|3:25,5,-48.5|4:0,180,0|5:10,10,1;n;2|6:Back|7:true|8:100,100;p;3;]==])
  143.  
  144. Model.Parent = script.Parent==workspace and script or workspace
  145.  
  146. for _,f in pairs(ActualScripts) do f() end
Advertisement
Add Comment
Please, Sign In to add comment