local folder = workspace:WaitForChild("Buildings")
local old = folder:FindFirstChild("GeneratedCity")
if old then old:Destroy() end
local city = Instance.new("Folder")
city.Name = "GeneratedCity"
city.Parent = folder
local colors = {
Color3.fromRGB(255, 190, 120),
Color3.fromRGB(120, 190, 235),
Color3.fromRGB(220, 145, 190),
Color3.fromRGB(155, 205, 145),
Color3.fromRGB(190, 165, 235)
}
local function part(parent, name, size, pos, color, material)
local p = Instance.new("Part")
p.Name = name
p.Size = size
p.Position = pos
p.Anchored = true
p.Material = material or Enum.Material.SmoothPlastic
p.Color = color
p.Parent = parent
return p
end
local function createBuilding(x, z, index)
local model = Instance.new("Model")
model.Name = "CityBuilding_" .. index
model.Parent = city
local height = 35 + (index % 3) * 12
local color = colors[(index - 1) % #colors + 1]
local front = x < 0 and 1 or -1
-- Основное здание
part(model, "BuildingBody",
Vector3.new(65, height, 90),
Vector3.new(x, height / 2, z), color)
-- Крыша
part(model, "Roof",
Vector3.new(69, 3, 94),
Vector3.new(x, height + 1.5, z),
Color3.fromRGB(65, 70, 85))
-- Окна на фасаде, обращённом к дороге
for level = 1, math.floor(height / 16) do
for offset = -27, 27, 18 do
part(model, "Window",
Vector3.new(0.6, 9, 10),
Vector3.new(
x + front * 32.8,
level * 16,
z + offset
),
Color3.fromRGB(115, 205, 245),
Enum.Material.Glass)
end
end
-- Входная дверь
part(model, "Entrance",
Vector3.new(1, 17, 13),
Vector3.new(x + front * 32.9, 8.5, z),
Color3.fromRGB(90, 55, 40))
-- Вывеска над входом
part(model, "ShopSign",
Vector3.new(1, 5, 25),
Vector3.new(x + front * 33.2, 20, z),
Color3.fromRGB(255, 225, 100))
end
local index = 0
for _, x in ipairs({-120, 120}) do
for z = -560, 560, 280 do
index += 1
createBuilding(x, z, index)
end
end
print("NPC WORLD: 10 buildings created!")