Self Building Room (Simple Concept)


  • Probably the longest script I have made, and now open to the public. It builds a small room in under 10 seconds. Not detailed, but its nice enough to be a Cool Creation, am I right? (Script in ServerScriptStorage if you want to test)

    wait(2)
    local brick1 = Instance.new("Part", game.Workspace)
    brick1.Name = "Floor"
    brick1.Position = Vector3.new(-1.5, 0.5, -10)
    brick1.Material = Enum.Material.Concrete
    brick1.Size = Vector3.new(37, 1, 36)
    
    wait(2)
    local backWall = Instance.new("Part", game.Workspace)
    backWall.Name = "BackWall"
    backWall.Position = Vector3.new(-1.5, 11, -27.5)
    backWall.Material = Enum.Material.Brick
    backWall.BrickColor = BrickColor.new("Bright red")
    backWall.Size = Vector3.new(35,20,1)
    
    wait(2)
    local leftWall = Instance.new("Part", game.Workspace)
    leftWall.Name = "LeftWall"
    leftWall.Position = Vector3.new(-19.5, 11, -10)
    leftWall.Material = Enum.Material.Brick
    leftWall.BrickColor = BrickColor.new("Bright red")
    leftWall.Size = Vector3.new(1,20,36)
    
    wait(2)
    local rightWall = Instance.new("Part", game.Workspace)
    rightWall.Name = "RightWall"
    rightWall.Position = Vector3.new(16.5, 11, -10)
    rightWall.Material = Enum.Material.Brick
    rightWall.BrickColor = BrickColor.new("Bright red")
    rightWall.Size = Vector3.new(1,20,36)
    
    wait()
    local model = Instance.new("Model", game.Workspace)
    model.Name = "SmallRoom"
    wait(1)
    brick1.Parent = model 
    backWall.Parent = model 
    leftWall.Parent = model
    rightWall.Parent = model
    

  • Changed it a bit around so that you and others can learn from it or it's easier to expand.

    function buildPart(name, pos, size, type)
      local brick = Instance.new("Part", game.Workspace)
      brick.Name = name
      brick.Position = pos
      --if name == "Floor" then
      if type == "Floor" then
        brick.Material = Enum.Material.Concrete
      elseif type == "Wall" then
        brick.Material = Enum.Material.Brick
        brick.BrickColor = BrickColor.new("Bright red")
      else 
    	print("Error: typo in partType")
      end
      brick.Size = size
      return brick
    end
    
    local partList = {
      {"Floor",        Vector3.new( -1.5, 0.5,   -10),     Vector3.new( 37,  1, 36),  "Floor"},
      {"BackWall",     Vector3.new( -1.5,  11, -27.5),     Vector3.new( 35, 20,  1),   "Wall"}, 
      {"LeftWall",     Vector3.new(-19.5,  11,   -10),     Vector3.new(  1, 20, 36),   "Wall"},
      {"RightWall",    Vector3.new( 16.5,  11,   -10),     Vector3.new(  1, 20, 36),   "Wall"}
    }
    
    for i=1, #partList do
      wait(2)
      partList[i][5] = buildPart(partList[i][1], partList[i][2], partList[i][3], partList[i][4])
    end
    
    local model = Instance.new("Model", game.Workspace)
    model.Name = "SmallRoom"
    wait(1)
    for i=1, #partList do
      partList[i][5].Parent = model
    end
    

  • function CreatePart(nm, size, pos, colour)
    local p = Instance.new('Part')
    p.Name = nm
    p.Anchored = true
    p.CanCollide = true
    p.CFrame = pos
    p.Size = size
    p.Material = 816
    p.BrickColor = BrickColor.new(colour)
    return p
    end
    
    local floor = CreatePart('Floor', Vector3.new(35,20,1), Vector3.new(-1.5, 11, -27.5), 'Medium stone grey')
    local bwall = CreatePart('BackWall', Vector3.new(35,20,1), Vector3.new(-1.5, 11, -27.5), 'Bright red')
    local lwall = CreatePart('LeftWall', Vector3.new(1,20,36), Vector3.new(-19.5, 11, -10), 'Bright red')
    local rwall = CreatePart('RightWall', Vector3.new(1,20,36), Vector3.new(16.5, 11, -10), 'Bright red')
    
    local house= Instance.new('Model')
    house.Name = "House"
    floor.Parent = house
    bwall.Parent = house
    lwall.Parent = house
    rwall.Parent = house
    house.Parent = Workspace -- Yw
    

  • @TheAlphaStigma Putting all your code on one line is not a step up, it's a step down.


  • simple fix :P

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.