Advertisement
NyonicBear

sadf

Feb 20th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1. user=players.LocalPlayer;
  2. uname=user.Name;
  3. guis=user.PlayerGui;
  4. pack=user.Backpack;
  5.  
  6. keyDowns={};
  7. freeKeys={};
  8. shortcuts={};
  9.  
  10. _G.mine=_G.mine or{};
  11.  
  12. name='Draw3D';
  13. url='http://www.roblox.com/asset/?id=%d';
  14.  
  15. iconNormal=url:format(96578285);
  16. iconOnDown=url:format(96584484);
  17.  
  18. ver=0;
  19. drawPixel=0.10;
  20. _G.drawLimit=_G.drawLimit or 1000;
  21.  
  22. _G.drawColor=_G.drawColor or Color3.new();
  23.  
  24.  
  25.  
  26.  
  27.  
  28. destroy=game.remove;
  29. find=game.findFirstChild;
  30. new=Instance.new;
  31. with=function(c)
  32. return function(p)
  33. local o=type(c)=='string'and new(c)or c;
  34. local x=p.Parent;p.Parent=nil;
  35. for i,v in next,p do
  36. o[i]=v;
  37. end;
  38. if(x)then
  39. o.Parent=x;
  40. end;
  41. return o;
  42. end;
  43. end;
  44. getPlace=function()
  45. if(find(workspace,'draw')==nil)then
  46. new('Model',workspace).Name='draw';
  47. end;
  48. if(find(workspace.draw,uname)==nil)then
  49. new('Model',workspace.draw).Name=uname;
  50. end;
  51. return workspace.draw[uname];
  52. end;
  53. drawLine=function(start,target)
  54. local gui=with'BlockMesh'{
  55. Parent=with'Part'{
  56. CFrame=CFrame.new(start,target)*CFrame.new(0,0,-(start-target).magnitude/2);
  57. Size=Vector3.new(drawPixel,drawPixel,(start-target).magnitude+.325*drawPixel);
  58. Parent=getPlace();
  59. Color=_G.drawColor;
  60. BottomSurface=0;
  61. Anchored=true;
  62. TopSurface=0;
  63. formFactor=3;
  64. Name=name;
  65. }}.Parent;
  66. table.insert(_G.mine,gui);
  67. return gui;
  68. end;
  69. onDown=function()
  70. if(drawing)then
  71. return nil;
  72. end;
  73. if(selectGui.Adornee)then
  74. destroy(selectGui.Adornee);
  75. end;
  76.  
  77. drawing=true;
  78.  
  79. mouse.Icon=iconOnDown;
  80. ver=ver+1;
  81.  
  82.  
  83. local cVer,start,target=ver,mouse.hit.p;
  84.  
  85. local group={};
  86. repeat
  87. Wait(0.02);
  88.  
  89. if(mouse.target and mouse.target.Name~=name and mouse.hit.p~=start)then
  90.  
  91. target=mouse.hit.p;
  92.  
  93. table.insert(group,drawLine(start,target));
  94.  
  95. start=target;
  96. end;
  97. until ver~=cVer;
  98. drawing=false;
  99.  
  100. local groupM=new('Model',getPlace());
  101. for i,v in next,group do
  102. if(v:IsDescendantOf(Workspace))then
  103. v.Parent=groupM;
  104. end;
  105. end;
  106. if(next(groupM:children())==nil)then
  107. destroy(groupM);
  108. end;
  109. end;
  110. onUp=function()
  111. mouse.Icon=iconNormal;
  112. ver=ver+1;
  113. end;
  114. onKeyDown=function(k)
  115. if(freeKeys[k]==false)then
  116. return false;
  117. end;
  118. freeKeys[k]=false;
  119. Wait(0.01);
  120. if(keyDowns[k])then
  121. keyDowns[k]();
  122. elseif(shortcuts[k])then
  123. shortcuts[k]();
  124. end;
  125. end;
  126. onKeyUp=function(k)
  127. freeKeys[k]=true;
  128. end;
  129. onMove=function()
  130.  
  131. end;
  132. onSelect=function(lmouse)
  133. frame.Visible=true;
  134.  
  135. mouse=lmouse;
  136.  
  137. mouse.Icon=iconNormal;
  138.  
  139. mouse.Button1Down:connect(onDown);
  140. mouse.KeyDown:connect(onKeyDown);
  141. mouse.Button1Up:connect(onUp);
  142. mouse.KeyUp:connect(onKeyUp);
  143. mouse.Move:connect(onMove);
  144. end;
  145. onDeselect=function()
  146. ver=ver+1;
  147. frame.Visible=false;
  148. selectGui.Adornee=nil;
  149. mouse.Icon=iconNormal;
  150. for i,v in next,freeKeys do
  151. freeKeys[i]=true;
  152. end;
  153. end;
  154. addButton=function(title,shortcut,fun)
  155. with'TextButton'{
  156. Text=string.format(' %s (%s)',title,shortcut);
  157. TextXAlignment=0;
  158. Parent=frame;
  159. }.MouseButton1Up:connect(fun);
  160.  
  161. shortcuts[shortcut]=fun;
  162.  
  163. local c=#frame:children();
  164. for i,v in next,frame:children()do
  165. v.Position=UDim2.new(0,0,0,20*(i-1));
  166. v.Size=UDim2.new(1,0,0,20);
  167. end;
  168.  
  169. frame.Position=UDim2.new(1,-152,.5,-c*10);
  170. frame.Size=UDim2.new(0,150,0,c*20);
  171. end;
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. for i,v in next,{guis;pack;}do
  181. pcall(function()
  182. repeat until destroy(v[name]);
  183. end);
  184. end;
  185.  
  186.  
  187.  
  188. tool=with'HopperBin'{
  189. Parent=pack;
  190. Name=name;
  191. };
  192. tool.Deselected:connect(onDeselect);
  193. tool.Selected:connect(onSelect);
  194.  
  195.  
  196.  
  197.  
  198. screen=with'ScreenGui'{
  199. Parent=guis;
  200. Name=name;
  201. };
  202. frame=with'Frame'{
  203. Parent=screen;
  204. Visible=false;
  205. };
  206. clframe=with'Frame'{
  207. Position=UDim2.new(.5,-50,.5,-50);
  208. Size=UDim2.new(0,100,0,100);
  209. Visible=false;
  210. Parent=screen;
  211. };
  212. selectGui=with'SelectionBox'{
  213. Parent=screen;
  214. };
  215.  
  216. local c=0;
  217. for y=0,7 do
  218. for x=0,7 do
  219. local color=BrickColor.palette(c).Color;
  220.  
  221. with'ImageButton'{
  222. Position=UDim2.new(.125*x,0,.125*y);
  223. Size=UDim2.new(.125,0,.125);
  224. BackgroundColor3=color;
  225. Parent=clframe;
  226. }.MouseButton1Up:connect(function()
  227. clframe.Visible=false;
  228. _G.drawColor=color;
  229. end);
  230.  
  231. c=c+1;
  232. end;
  233. end;
  234.  
  235. addButton('Color','c',function()
  236. clframe.Visible=true;
  237. end);
  238. addButton('Remove your draws','r',function()
  239. repeat
  240. destroy(_G.mine[1]);
  241. table.remove(_G.mine,1);
  242. Wait(0.01);
  243. until nil;
  244. end);
  245. addButton('Remove global draws','k',function()
  246. destroy(workspace.draw);
  247. while(_G.mine[1])do
  248. destroy(_G.mine[1]);
  249. table.remove(_G.mine,1);
  250. end;
  251. end);
  252. addButton('Remove selected','x',function()
  253. repeat
  254. if(find(workspace,'draw'))then
  255. local dt=mouse.target;
  256. if(dt and dt:IsDescendantOf(workspace.draw))then
  257. selectGui.Adornee=dt.Parent;
  258. else
  259. selectGui.Adornee=nil;
  260. end;
  261. else
  262. selectGui.Adornee=nil;
  263. end;
  264. Wait(0.01);
  265. until freeKeys.x;
  266. selectGui.Adornee=nil;
  267. end);
  268.  
  269.  
  270.  
  271.  
  272. repeat
  273. Wait(0.01);
  274. if(next(_G.mine)and _G.mine[_G.drawLimit])then
  275. destroy(_G.mine[1]);
  276. table.remove(_G.mine,1);
  277. end;
  278. until script.Parent==nil or tool.Parent==nil;
  279. script.Disabled=true;
  280. destroy(screen);
  281.  
  282.  
  283. --Dresmor Alakazard--
  284. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement