Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Use with "LocalScript"...]]
- Wait();
- local User=Game:service'Players'.LocalPlayer or
- Game:service'Players'.DuelingBlades;
- local Brick={};
- local Current_Brick=1;
- local Brick_Size={
- X=8;
- Y=8;
- Z=8;
- };
- local FindObject=function(Object,Property,Value)
- for i,v in next,Object:children()do
- if(v[Property]==Value)then
- return v;
- end;
- end;
- end;
- local ObjectWait=function(Object,Property,Value)
- local Found=FindObject(Object,Property,Value);
- if(Found==nil)then
- while(Found==nil)do
- Found=Object.ChildAdded:wait();
- if(Found[Property]==Value)then
- break;
- else
- Found=nil;
- end;
- end;
- end;
- return Found;
- end;
- local PropertyWait=function(Object,Property)
- if(Object[Property]==nil)then
- while(Object[Property]==nil)do
- Object.Changed:wait();
- end;
- end;
- return Object[Property];
- end;
- local AddBrick=function(Name,Properties)
- Properties.Anchored=Properties.Anchored or true;
- Properties.formFactor=Properties.formFactor or 3;
- Properties.TopSurface=Properties.TopSurface or 0;
- Properties.BottomSurface=Properties.BottomSurface or 0;
- Brick[#Brick+1]={Name=Name;Properties=Properties;};
- end;
- local LoadBrick=function(Number,Size,CFrame)
- local Warehouse=Workspace:FindFirstChild'Ohgal_Warehouse'or Instance.new('Model',Workspace);
- Warehouse.Name='Ohgal_Warehouse';
- local Brick_Warehouse=Warehouse:FindFirstChild(Brick[Number].Name..'_Warehouse')or Instance.new('Model',Warehouse);
- Brick_Warehouse.Name=Brick[Number].Name..'_Warehouse';
- local Part=Instance.new'Part';
- for i,v in next,Brick[Number].Properties do
- local Type=type(v);
- if(Type~='table'and Type~='function')then
- Part[i]=v;
- elseif(Type=='table')then
- Part[i]=v[math.random(1,#v)];
- elseif(Type=='function')then
- Part[i]=v();
- end;
- end;
- Part.CFrame=CFrame;
- Part.Size=Size+Vector3.new(math.random()/10,math.random()/10,math.random()/10);
- Part.Parent=Brick_Warehouse;
- end;
- local Modes={
- ['Build']=function(Mouse)
- if(Mouse.Target~=nil)then
- LoadBrick(Current_Brick,Vector3.new(Brick_Size.X,Brick_Size.Y,Brick_Size.Z),CFrame.new(Mouse.Hit.p));
- end;
- end;
- ['Move']=function(Mouse)
- if(Selection_Box.Adornee~=nil)then
- local Target=Selection_Box.Adornee;
- local Connection=Mouse.Move:connect(function()
- if(Mouse.Target~=Target)then
- Target.CFrame=CFrame.new(Mouse.Hit.p);
- else
- Target.CFrame=CFrame.new(Mouse.Hit.p.X,Target.Position.Y,Mouse.Hit.p.Z);
- end;
- end);
- Mouse.Button1Up:wait();
- Connection:disconnect();
- end;
- end;
- ['Destroy']=function(Mouse)
- if(Selection_Box.Adornee~=nil)then
- pcall(Selection_Box.Adornee.Remove,Selection_Box.Adornee);
- end;
- end;
- };
- local Mode=Instance.new'StringValue';
- Mode.Value='Build';
- Mode.Changed:connect(function(Value)
- Mode_Text_Label.Text='Mode: '..Value..' of Move(m), Destroy(r), Build(b)';
- end);
- coroutine.wrap(function()
- local Gui=ObjectWait(User,'className','PlayerGui');
- for i,v in next,Gui:children()do
- if(v.className=='ScreenGui'and v.Name=='Dresmor Alakazard - Gen')then
- pcall(v.Destroy,v);
- end;
- end;
- local Hide=false;
- Form=Instance.new('ScreenGui',Gui);
- Form.Name='Dresmor Alakazard - Gen';Wait();
- Selection_Box=Instance.new('SelectionBox',Form);
- Frame=Instance.new('Frame',Form);
- Frame.Position=UDim2.new(1,-302,.5,-100);
- Frame.Size=UDim2.new(0,300,0,200);
- Hide_Button=Instance.new('TextButton',Frame);
- Hide_Button.Position=UDim2.new(0,-22);
- Hide_Button.Size=UDim2.new(0,20,0,20);
- Hide_Button.FontSize=6;
- Hide_Button.Text='->';
- Hide_Button.Font=2;
- Hide_Button.MouseButton1Down:connect(function()
- Hide=Hide==false;
- Frame.Position=Hide==true and UDim2.new(1,0,.5,-100)or UDim2.new(1,-302,.5,-100);
- Hide_Button.Text=Hide==true and'<-'or'->';
- end);
- Mode_Text_Label=Instance.new('TextLabel',Frame);
- Mode_Text_Label.Text='Mode: '..Mode.Value..' of Move(m), Destroy(r), Build(b)';
- Mode_Text_Label.Position=UDim2.new(0,2,0,2);
- Mode_Text_Label.Size=UDim2.new(1,-4,.5,-3);
- Mode_Text_Label.TextYAlignment=0;
- Mode_Text_Label.TextXAlignment=0;
- Mode_Text_Label.FontSize=3;
- Brick_Mode_Text_Label=Instance.new('TextLabel',Frame);
- Brick_Mode_Text_Label.Text=Brick[Current_Brick].Name..' ('..Current_Brick..' of '..#Brick..') (To change press "e" or "q")';
- Brick_Mode_Text_Label.Position=UDim2.new(0,2,.5,1);
- Brick_Mode_Text_Label.Size=UDim2.new(1,-4,.25,-2);
- Brick_Mode_Text_Label.TextYAlignment=0;
- Brick_Mode_Text_Label.TextXAlignment=0;
- Brick_Mode_Text_Label.FontSize=3;
- Tutorial_Text_Label=Instance.new('TextLabel',Frame);
- 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;
- Tutorial_Text_Label.Position=UDim2.new(0,2,.75,1);
- Tutorial_Text_Label.Size=UDim2.new(1,-4,.25,-3);
- Tutorial_Text_Label.TextYAlignment=0;
- Tutorial_Text_Label.TextXAlignment=0;
- Tutorial_Text_Label.FontSize=3;
- for i,v in next,Frame:children()do
- v.TextWrapped=true;
- end;
- end)();
- local Bag=ObjectWait(User,'className','Backpack');
- for i,v in next,Bag:children()do
- if(v.Name=='Gen')then
- pcall(v.Destroy,v);
- end;
- end;
- local Bin=Instance.new('HopperBin',Bag);
- Bin.Name='Gen';
- Bin.Selected:connect(function(Mouse)
- Mouse.Button1Down:connect(function()
- Modes[Mode.Value](Mouse);
- if(Mouse.Target~=nil and Workspace:FindFirstChild'Ohgal_Warehouse':IsAncestorOf(Mouse.Target)==true)then
- Selection_Box.Adornee=Mouse.Target;
- else
- Selection_Box.Adornee=nil;
- end;
- end);
- Mouse.KeyDown:connect(function(Key)
- if(Key=='r')then
- Mode.Value='Destroy';
- elseif(Key=='b')then
- Mode.Value='Build';
- elseif(Key=='m')then
- Mode.Value='Move';
- elseif(Key=='q')then
- Current_Brick=Current_Brick-1;
- if(Current_Brick==0)then
- Current_Brick=#Brick;
- end;
- elseif(Key=='e')then
- Current_Brick=Current_Brick+1;
- if(Current_Brick>#Brick)then
- Current_Brick=1;
- end;
- elseif(Key=='h')then
- Brick_Size.X=Brick_Size.X+1;
- elseif(Key=='j')then
- Brick_Size.Y=Brick_Size.Y+1;
- elseif(Key=='k')then
- Brick_Size.Z=Brick_Size.Z+1;
- elseif(Key=='x')then
- Brick_Size.X=Brick_Size.X-1;
- if(Brick_Size.X==0)then
- Brick_Size.X=1;
- end;
- elseif(Key=='c')then
- Brick_Size.Y=Brick_Size.Y-1;
- if(Brick_Size.Y==0)then
- Brick_Size.Y=1;
- end;
- elseif(Key=='v')then
- Brick_Size.Z=Brick_Size.Z-1;
- if(Brick_Size.Z==0)then
- Brick_Size.Z=1;
- end;
- end;
- 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;
- Brick_Mode_Text_Label.Text=Brick[Current_Brick].Name..' ('..Current_Brick..' of '..#Brick..') (To change press "e" or "q")';
- end);
- local Warehouse;
- Mouse.Move:connect(function()
- Warehouse=Workspace:FindFirstChild'Ohgal_Warehouse';
- if(Warehouse)then
- if(Mouse.Target~=nil and Warehouse:IsAncestorOf(Mouse.Target)==true)then
- Selection_Box.Adornee=Mouse.Target;
- else
- Selection_Box.Adornee=nil;
- end;
- end;
- end);
- end);
- Bin.Deselected:connect(function()
- Selection_Box.Adornee=nil;
- end);
- AddBrick('Grass',{
- BrickColor={BrickColor.new(37);BrickColor.new(141);BrickColor.new(28);};
- Material='Grass';
- }
- );
- AddBrick('Earth',{
- BrickColor=BrickColor.new(217);
- Material='Concrete';
- }
- );
- AddBrick('Dark Earth',{
- BrickColor=BrickColor.new(192);
- Material='Concrete';
- }
- );
- AddBrick('Sand',{
- BrickColor=BrickColor.new(5);
- Material='Concrete';
- }
- );
- AddBrick('Wood',{
- BrickColor=BrickColor.new(192);
- Material='Wood';
- }
- );
- AddBrick('Stone',{
- BrickColor=BrickColor.new(199);
- Material='Slate';
- }
- );
- AddBrick('Ice',{
- BrickColor=BrickColor.new(102);
- Material='Ice';
- }
- );
- if(script~=nil)then
- script.Name='Dresmor Alakazard - Gen';
- end;
- print'"Dresmor Alakazard - Gen" running';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement