Basically, I’m making a chunk load system and I want to get all the chunks (If there are 16 chunks, it gets the 16 and not any other number).
Example:
Local c1 = game.Workspace.Folder:FindFirstChild(“Chunk”… 7)
And get them one by one, cloning them, and putting them in workspace.
How can I achieve that?
You think you could try out a pseudo code example of what you want to try to do?
e.g.
if there are 5 chunks, then
unload chunks 1 to 4
what
do you want to get its index (order in table) or numbers on its name?
you can use a loop to iterate through the numbers and find each chunk
, here’s a script
local folder = -- refer to this folder ( Ensure that the chunks are children of it )
local chunks = 16
for i = 1, chunks do
local chunkName = " whateveryou want ".. i
local chunk = Folder:FindFirstChild(chunkName)
if chunk then
local clone = chunk:clone()
clone.Parent = game.Workspace
else
print("Not found ") -- debugging you can adjust this
end
end
we aint on scratch here bud
(stuff)
no, i just have trouble understanding what he wants to get done. plus, pseudo code is used so often, and it’s not specially locked to beginner level programmers
If i’m understanding correctly, he wants to have his chunks like this, " chunk1 ", " chunck2 " all way to 16
I don’t recommend asking CHATGPT for a script, lol.
i also dont recommend stealing code from chatgpt
Can’t you use a for loop + tables?
local c1 = game.Workspace.Folder:GetChildren()
for index, chunk in c1 do
local clonedchunk = chunk:Clone()
clonedchunk.Parent = workspace
end
Wow I got two solutions at the same time. Crazy.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.