Randomly Generated Map

What do you want to achieve? I wan’t to achieve being able to make a Randomly Generated Map like in scp-3008: 3008 [2.7] - Roblox ( Created by Uglyburger0 )

What is the issue? I have no idea how i would even start

What solutions have you tried so far? I have looked on Youtube, DevForums, Tried Myself and asked through Discord and Guilded.

If anyone has a solution please reply!

You should link the game you’re using as reference.

1 Like

I have no scripting knowledge, but I think you should start by building nodes that will be used in random generation, usually a set number of studs in scale per tile. For example, SCP 3008 has bedroom nodes, shelf nodes, and food nodes. Start by making those and then implement random generation, if you haven’t already

the game you showed just looks like a simple grid of models

here is a demo project of how to generate a grid of models
Randomly Generated Map.rbxl (36.1 KB)


and this is the script inside the demo project

local random = Random.new()
-- how many models to generate (16x16 = 256 models)
local worldSize = 16
-- a list of all the models
local models = game.ServerStorage.Models:GetChildren()
-- the amount of space between models
local spacing = 80
-- a offset to where to spawn the models
local offset = Vector3.new(-worldSize * spacing / 2, 0, -worldSize * spacing / 2)

-- list of cframes rotated in 4 directions
local cFrames = {
	CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
	CFrame.new(0, 0, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0),
	CFrame.new(0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1),
	CFrame.new(0, 0, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
}

for x = 1, worldSize do
	for z = 1, worldSize do
		-- select a random model
		local mi = random:NextInteger(1, #models)
		local model = models[mi]
		
		-- select a random cframe
		local ci = random:NextInteger(1, #cFrames)
		local cFrame = cFrames[ci]
		
		-- clone the model and set the pivot to the cframe + x and z
		local clone = model:Clone()
		clone:PivotTo(cFrame + offset + Vector3.new(x * spacing, 0, z * spacing))
		clone.Parent = workspace
	end
end

and this is the result i just made 2 quick models 1 with red parts and one with green parts

5 Likes

I have made the plots :smiley: But i appreciate your help!

1 Like

Thank you! This is really helpfull!