So i'm trying to make a world that generates itself randomly in a grid in a radius around the player but i have no idea how to and methods of doing something like this?

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
while wait(5) do
	
	for i,Chunk in pairs (game.Workspace.Folder:GetDescendants()) do
		if Chunk.Name == "Base" and Chunk:IsA("Part") and (Vector3.new(char.HumanoidRootPart.Position.X,49,char.HumanoidRootPart.Position.X) - Chunk.Position).Magnitude <= 120 then
			for i,subchunk in pairs(game.Workspace.Folder:GetDescendants()) do
		if subchunk.Name == "Base" and subchunk:IsA("Part") then
				if (Chunk.CFrame * CFrame.new(64,0,0)).X == subchunk.CFrame.X then
					
					else
				local model = game.ReplicatedStorage.TestChunkSize1:Clone()
			model.Parent=workspace.Folder
model:SetPrimaryPartCFrame(Chunk.CFrame * CFrame.new(64,0,0))
                                               end
			end
		end
		end
	end
	
end
	

end) end)

1 comment

0

The first thing you should do it list out the process, currently it looks like every time a player is spawned you create a map which isn't recommended. Plan out the process first then decide on what you want to be spawned in such as obstacles, chunks and items. Then you should do cframe calculations based on the size of the obstacles.