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
11 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
11 years ago

I would generate it dimension by dimension.

01for i = 1,5 do
02    local newBlock = Instance.new("Part")
03    newBlock.FormFactor = "Symmetric"
04    newBlock.Size = Vector3.new(5, 5, 5)
05    newBlock.Position = Vector3.new(i * 5, 0, 0)
06    newBlock.Anchored = true
07    newBlock.Parent = workspace
08    for _ = 2,5 do
09        local newBlock = Instance.new("Part")
10        newBlock.FormFactor = "Symmetric"
11        newBlock.Size = Vector3.new(5, 5, 5)
12        newBlock.Position = Vector3.new(i * 5, 0, (_ * 5) - 5)
13        newBlock.Anchored = true
14        newBlock.Parent = workspace
15    end
16end

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

Ad

Answer this question