Advertisement
colddddda

Untitled

Apr 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.84 KB | None | 0 0
  1. --[[Use with "LocalScript"...]]
  2.  
  3. Wait();
  4.  
  5. local User=Game:service'Players'.LocalPlayer or
  6. Game:service'Players'.DuelingBlades;
  7.  
  8.  
  9. local Brick={};
  10. local Current_Brick=1;
  11. local Brick_Size={
  12. X=8;
  13. Y=8;
  14. Z=8;
  15. };
  16.  
  17.  
  18.  
  19. local FindObject=function(Object,Property,Value)
  20. for i,v in next,Object:children()do
  21. if(v[Property]==Value)then
  22. return v;
  23. end;
  24. end;
  25. end;
  26. local ObjectWait=function(Object,Property,Value)
  27. local Found=FindObject(Object,Property,Value);
  28. if(Found==nil)then
  29. while(Found==nil)do
  30. Found=Object.ChildAdded:wait();
  31. if(Found[Property]==Value)then
  32. break;
  33. else
  34. Found=nil;
  35. end;
  36. end;
  37. end;
  38. return Found;
  39. end;
  40. local PropertyWait=function(Object,Property)
  41. if(Object[Property]==nil)then
  42. while(Object[Property]==nil)do
  43. Object.Changed:wait();
  44. end;
  45. end;
  46. return Object[Property];
  47. end;
  48. local AddBrick=function(Name,Properties)
  49. Properties.Anchored=Properties.Anchored or true;
  50. Properties.formFactor=Properties.formFactor or 3;
  51. Properties.TopSurface=Properties.TopSurface or 0;
  52. Properties.BottomSurface=Properties.BottomSurface or 0;
  53.  
  54. Brick[#Brick+1]={Name=Name;Properties=Properties;};
  55. end;
  56. local LoadBrick=function(Number,Size,CFrame)
  57. local Warehouse=Workspace:FindFirstChild'Ohgal_Warehouse'or Instance.new('Model',Workspace);
  58. Warehouse.Name='Ohgal_Warehouse';
  59. local Brick_Warehouse=Warehouse:FindFirstChild(Brick[Number].Name..'_Warehouse')or Instance.new('Model',Warehouse);
  60. Brick_Warehouse.Name=Brick[Number].Name..'_Warehouse';
  61.  
  62. local Part=Instance.new'Part';
  63. for i,v in next,Brick[Number].Properties do
  64. local Type=type(v);
  65. if(Type~='table'and Type~='function')then
  66. Part[i]=v;
  67. elseif(Type=='table')then
  68. Part[i]=v[math.random(1,#v)];
  69. elseif(Type=='function')then
  70. Part[i]=v();
  71. end;
  72. end;
  73. Part.CFrame=CFrame;
  74. Part.Size=Size+Vector3.new(math.random()/10,math.random()/10,math.random()/10);
  75. Part.Parent=Brick_Warehouse;
  76. end;
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. local Modes={
  85. ['Build']=function(Mouse)
  86. if(Mouse.Target~=nil)then
  87. LoadBrick(Current_Brick,Vector3.new(Brick_Size.X,Brick_Size.Y,Brick_Size.Z),CFrame.new(Mouse.Hit.p));
  88. end;
  89. end;
  90. ['Move']=function(Mouse)
  91. if(Selection_Box.Adornee~=nil)then
  92. local Target=Selection_Box.Adornee;
  93. local Connection=Mouse.Move:connect(function()
  94. if(Mouse.Target~=Target)then
  95. Target.CFrame=CFrame.new(Mouse.Hit.p);
  96. else
  97. Target.CFrame=CFrame.new(Mouse.Hit.p.X,Target.Position.Y,Mouse.Hit.p.Z);
  98. end;
  99. end);
  100. Mouse.Button1Up:wait();
  101. Connection:disconnect();
  102. end;
  103. end;
  104. ['Destroy']=function(Mouse)
  105. if(Selection_Box.Adornee~=nil)then
  106. pcall(Selection_Box.Adornee.Remove,Selection_Box.Adornee);
  107. end;
  108. end;
  109. };
  110.  
  111. local Mode=Instance.new'StringValue';
  112. Mode.Value='Build';
  113. Mode.Changed:connect(function(Value)
  114. Mode_Text_Label.Text='Mode: '..Value..' of Move(m), Destroy(r), Build(b)';
  115. end);
  116.  
  117.  
  118.  
  119.  
  120.  
  121. coroutine.wrap(function()
  122. local Gui=ObjectWait(User,'className','PlayerGui');
  123.  
  124. for i,v in next,Gui:children()do
  125. if(v.className=='ScreenGui'and v.Name=='Dresmor Alakazard - Gen')then
  126. pcall(v.Destroy,v);
  127. end;
  128. end;
  129.  
  130. local Hide=false;
  131.  
  132. Form=Instance.new('ScreenGui',Gui);
  133. Form.Name='Dresmor Alakazard - Gen';Wait();
  134. Selection_Box=Instance.new('SelectionBox',Form);
  135.  
  136. Frame=Instance.new('Frame',Form);
  137. Frame.Position=UDim2.new(1,-302,.5,-100);
  138. Frame.Size=UDim2.new(0,300,0,200);
  139. Hide_Button=Instance.new('TextButton',Frame);
  140. Hide_Button.Position=UDim2.new(0,-22);
  141. Hide_Button.Size=UDim2.new(0,20,0,20);
  142. Hide_Button.FontSize=6;
  143. Hide_Button.Text='->';
  144. Hide_Button.Font=2;
  145. Hide_Button.MouseButton1Down:connect(function()
  146. Hide=Hide==false;
  147. Frame.Position=Hide==true and UDim2.new(1,0,.5,-100)or UDim2.new(1,-302,.5,-100);
  148. Hide_Button.Text=Hide==true and'<-'or'->';
  149. end);
  150. Mode_Text_Label=Instance.new('TextLabel',Frame);
  151. Mode_Text_Label.Text='Mode: '..Mode.Value..' of Move(m), Destroy(r), Build(b)';
  152. Mode_Text_Label.Position=UDim2.new(0,2,0,2);
  153. Mode_Text_Label.Size=UDim2.new(1,-4,.5,-3);
  154. Mode_Text_Label.TextYAlignment=0;
  155. Mode_Text_Label.TextXAlignment=0;
  156. Mode_Text_Label.FontSize=3;
  157. Brick_Mode_Text_Label=Instance.new('TextLabel',Frame);
  158. Brick_Mode_Text_Label.Text=Brick[Current_Brick].Name..' ('..Current_Brick..' of '..#Brick..') (To change press "e" or "q")';
  159. Brick_Mode_Text_Label.Position=UDim2.new(0,2,.5,1);
  160. Brick_Mode_Text_Label.Size=UDim2.new(1,-4,.25,-2);
  161. Brick_Mode_Text_Label.TextYAlignment=0;
  162. Brick_Mode_Text_Label.TextXAlignment=0;
  163. Brick_Mode_Text_Label.FontSize=3;
  164. Tutorial_Text_Label=Instance.new('TextLabel',Frame);
  165. Tutorial_Text_Label.Text='To change size press (h,j,k | x,c,v)'..'\n'..'Size: '..Brick_Size.X..', '..Brick_Size.Y..', '..Brick_Size.Z;
  166. Tutorial_Text_Label.Position=UDim2.new(0,2,.75,1);
  167. Tutorial_Text_Label.Size=UDim2.new(1,-4,.25,-3);
  168. Tutorial_Text_Label.TextYAlignment=0;
  169. Tutorial_Text_Label.TextXAlignment=0;
  170. Tutorial_Text_Label.FontSize=3;
  171.  
  172. for i,v in next,Frame:children()do
  173. v.TextWrapped=true;
  174. end;
  175.  
  176. end)();
  177.  
  178. local Bag=ObjectWait(User,'className','Backpack');
  179.  
  180. for i,v in next,Bag:children()do
  181. if(v.Name=='Gen')then
  182. pcall(v.Destroy,v);
  183. end;
  184. end;
  185.  
  186. local Bin=Instance.new('HopperBin',Bag);
  187. Bin.Name='Gen';
  188.  
  189. Bin.Selected:connect(function(Mouse)
  190. Mouse.Button1Down:connect(function()
  191. Modes[Mode.Value](Mouse);
  192. if(Mouse.Target~=nil and Workspace:FindFirstChild'Ohgal_Warehouse':IsAncestorOf(Mouse.Target)==true)then
  193. Selection_Box.Adornee=Mouse.Target;
  194. else
  195. Selection_Box.Adornee=nil;
  196. end;
  197. end);
  198. Mouse.KeyDown:connect(function(Key)
  199. if(Key=='r')then
  200. Mode.Value='Destroy';
  201. elseif(Key=='b')then
  202. Mode.Value='Build';
  203. elseif(Key=='m')then
  204. Mode.Value='Move';
  205. elseif(Key=='q')then
  206. Current_Brick=Current_Brick-1;
  207. if(Current_Brick==0)then
  208. Current_Brick=#Brick;
  209. end;
  210. elseif(Key=='e')then
  211. Current_Brick=Current_Brick+1;
  212. if(Current_Brick>#Brick)then
  213. Current_Brick=1;
  214. end;
  215. elseif(Key=='h')then
  216. Brick_Size.X=Brick_Size.X+1;
  217. elseif(Key=='j')then
  218. Brick_Size.Y=Brick_Size.Y+1;
  219. elseif(Key=='k')then
  220. Brick_Size.Z=Brick_Size.Z+1;
  221. elseif(Key=='x')then
  222. Brick_Size.X=Brick_Size.X-1;
  223. if(Brick_Size.X==0)then
  224. Brick_Size.X=1;
  225. end;
  226. elseif(Key=='c')then
  227. Brick_Size.Y=Brick_Size.Y-1;
  228. if(Brick_Size.Y==0)then
  229. Brick_Size.Y=1;
  230. end;
  231. elseif(Key=='v')then
  232. Brick_Size.Z=Brick_Size.Z-1;
  233. if(Brick_Size.Z==0)then
  234. Brick_Size.Z=1;
  235. end;
  236. end;
  237. Tutorial_Text_Label.Text='To change size press (h,j,k | x,c,v)'..'\n'..'Size: '..Brick_Size.X..', '..Brick_Size.Y..', '..Brick_Size.Z;
  238. Brick_Mode_Text_Label.Text=Brick[Current_Brick].Name..' ('..Current_Brick..' of '..#Brick..') (To change press "e" or "q")';
  239. end);
  240. local Warehouse;
  241. Mouse.Move:connect(function()
  242. Warehouse=Workspace:FindFirstChild'Ohgal_Warehouse';
  243. if(Warehouse)then
  244. if(Mouse.Target~=nil and Warehouse:IsAncestorOf(Mouse.Target)==true)then
  245. Selection_Box.Adornee=Mouse.Target;
  246. else
  247. Selection_Box.Adornee=nil;
  248. end;
  249. end;
  250. end);
  251. end);
  252. Bin.Deselected:connect(function()
  253. Selection_Box.Adornee=nil;
  254. end);
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263. AddBrick('Grass',{
  264. BrickColor={BrickColor.new(37);BrickColor.new(141);BrickColor.new(28);};
  265. Material='Grass';
  266. }
  267. );
  268. AddBrick('Earth',{
  269. BrickColor=BrickColor.new(217);
  270. Material='Concrete';
  271. }
  272. );
  273. AddBrick('Dark Earth',{
  274. BrickColor=BrickColor.new(192);
  275. Material='Concrete';
  276. }
  277. );
  278. AddBrick('Sand',{
  279. BrickColor=BrickColor.new(5);
  280. Material='Concrete';
  281. }
  282. );
  283. AddBrick('Wood',{
  284. BrickColor=BrickColor.new(192);
  285. Material='Wood';
  286. }
  287. );
  288. AddBrick('Stone',{
  289. BrickColor=BrickColor.new(199);
  290. Material='Slate';
  291. }
  292. );
  293. AddBrick('Ice',{
  294. BrickColor=BrickColor.new(102);
  295. Material='Ice';
  296. }
  297. );
  298.  
  299.  
  300.  
  301.  
  302. if(script~=nil)then
  303. script.Name='Dresmor Alakazard - Gen';
  304. end;
  305.  
  306. print'"Dresmor Alakazard - Gen" running';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement