Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I randomize the type of building and spawn them in a line?

I have it so it builds a basic house, I just want it so it spawns like 12 in a line but each one is different in color and size..But I want it randomly generated..Here's what I have so far:

brck = Instance.new("Part")
brck.Name = "One"
brck.Parent = game.Workspace
brck.Anchored = true
brck.Size = Vector3.new(30,20,25)
brck.BrickColor = BrickColor.new("Pastel brown")
brck.BottomSurface = "Smooth"
brck.TopSurface = "Smooth"

game.Workspace.BasePlate.Texture.Parent = game.Workspace.One
game.Workspace.BasePlate.Texture2.Parent = game.Workspace.One
game.Workspace.BasePlate.Texture3.Parent = game.Workspace.One
game.Workspace.BasePlate.Texture4.Parent = game.Workspace.One

roof = Instance.new("Part")
roof.Name = "Roof"
roof.Parent = game.Workspace
roof.Anchored = true
roof.Size = Vector3.new(35,2,30)
roof.Position = Vector3.new(0,20.5,0)
roof.BrickColor = BrickColor.new("Brown")
roof.TopSurface = "Smooth"
roof.BottomSurface = "Smooth"

1 answer

I can help you on the random part..

RandomBuildings = game.Lighting.Buildings:GetChildren() -- Going to have to change this to go to the buildings
Building = math.random(1,#RandomBuildings) -- What this should do is select 1 building randomly.

This discussion is preserved as it was. New answers, comments, and votes are closed.