Hello!
-
I wanted to assign blocks to specific positions using this script.
-
I don’t know how to write function and for loop to iterate by each block.
-
I tried fixing it but i didn’t work
local RS = game:GetService("ReplicatedStorage")
local onecf = workspace.FolderOfpos.one.Position --pos fold
local twocf = workspace.FolderOfpos.two.Position
local threecf = workspace.FolderOfpos.three.Position
local fourcf = workspace.FolderOfpos.four.Position
local meshfolder = RS.Blocks
local arrayOfCFs = {
onecf,
twocf,
threecf,
fourcf
}
local a = math.random(1, #arrayOfCFs)
print(a)
local b = meshfolder.oneblock
b.Position = arrayOfCFs[a]
table.remove(arrayOfCFs, a)
local c = math.random(1, #arrayOfCFs)
print(c)
local d = meshfolder.twoblock
d.Position = arrayOfCFs[c]
table.remove(arrayOfCFs, c)
local e = math.random(1, #arrayOfCFs)
print(e)
local f = meshfolder.threeblock
f.Position = arrayOfCFs[e]
table.remove(arrayOfCFs, e)
local g = math.random(1, #arrayOfCFs)
print(g)
local h = meshfolder.fourblock
h.Position = arrayOfCFs[g]
table.remove(arrayOfCFs, g)
for _, block in pairs(meshfolder:GetChildren()) do
block:Clone().Parent = workspace
end