Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How could i make a 5x5 grid?

Asked by
RubenKan 3615 Moderation Voter Administrator Community Moderator
10 years ago

I'm re-creating motherload, and now i want to add generated puzzels in my field, but the only way i think of that it could work is to re-calculate the distance between the puzzel's center and a new vector3 value, but i think this would be easier with using a 5x5 grid (becouse my blocks are 5x5x5 wide). but i dont know how to get that to work. anyone have an idea?

1 answer

Log in to vote
0
Answered by
Link43758 175
10 years ago

I would generate it dimension by dimension.

for i = 1,5 do
    local newBlock = Instance.new("Part")
    newBlock.FormFactor = "Symmetric"
    newBlock.Size = Vector3.new(5, 5, 5)
    newBlock.Position = Vector3.new(i * 5, 0, 0)
    newBlock.Anchored = true
    newBlock.Parent = workspace
    for _ = 2,5 do
        local newBlock = Instance.new("Part")
        newBlock.FormFactor = "Symmetric"
        newBlock.Size = Vector3.new(5, 5, 5)
        newBlock.Position = Vector3.new(i * 5, 0, (_ * 5) - 5)
        newBlock.Anchored = true
        newBlock.Parent = workspace
    end
end

This script managed to generate a 5x5 grid of blocks.

Ad

Answer this question