You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Using a coroutine to quickly generate a world -
What is the issue? Include screenshots / videos if possible!
When usingcoroutine.resume(), it says

-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried usingcoroutine.wrap(), but for some reason it just crashes my Studio.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local partContainer = workspace:WaitForChild("World")
local fogScreenSize = 25
local resolution = 100
local frequency = 3
local amplitude = 10
local seed = os.time()
local startPos = Vector3.new(-37,67,-37)
local routines = {}
local statuses = {}
local function getHeight(x,z)
local noiseHeight = math.noise(x / resolution*frequency,z / resolution*frequency,seed)
return noiseHeight
end
local chunks = {}
local function compressWorldToChunk(parts, chunkX, chunkZ)
local partsCopy = parts
local partNum = math.random(1, #partsCopy)
local part = partsCopy[partNum]
table.remove(partsCopy, partNum)
local union = part:UnionAsync(partsCopy)
union.Parent = game.Workspace.Chunks
chunks[tostring(chunkX)..","..tostring(chunkZ)] = union
for i, v in pairs(game.Workspace.World:GetChildren()) do
v:Destroy()
end
return union
end
local function makeChunk(chunkx, chunkz)
local parts = {}
for x = 0, fogScreenSize do
for z = 0, fogScreenSize do
local part = Instance.new("Part")
part.Parent = partContainer
part.Anchored = true
part.Size = Vector3.new(1,1,1)
part.BrickColor = BrickColor.new("Parsley green")
part.Material = Enum.Material.SmoothPlastic
local height = getHeight(x+(chunkx*fogScreenSize),z+(chunkz*fogScreenSize))
part.Position = Vector3.new(x, height*amplitude, z) + Vector3.new(-37+(chunkx*fogScreenSize),67,-37+(chunkz*fogScreenSize))
table.insert(parts, part)
end
game:GetService("RunService").Heartbeat:Wait()
end
compressWorldToChunk(parts, chunkx, chunkz)
return parts
end
for i = 0, 8 do
local func = coroutine.create(function()
for v = 0, 8 do
local parts = makeChunk(i, v)
end
end)
coroutine.resume(func)
table.insert(routines, func)
end
local all = true
repeat
for i, v in pairs(routines) do
if coroutine.status(v) == "dead" then
all = false
end
end
until all
for i, v in pairs(routines) do
coroutine.close(v)
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.