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

Setting Region3 SIZE to grid part SIZE??

Asked by 5 years ago
Edited 5 years ago

The below code is to create a grid for my game. I am trying to add a region3 to each grid piece so that it can be "Captured" by players.

I'm getting an error "Size cannot be assigned to" and thats all it says. Not too familiar with Region3

local base = game.Workspace.Baseplate
base.Transparency = 1
base.CanCollide = false

local model = Instance.new("Model", game.Workspace)
model.Name = "Grid"

for i = 1, 50, 1 do 
    for j =1, 50, 1 do
        local part = Instance.new("Part", model)
        local region = Region3.new(Vector3.new(),Vector3.new())

        part.Name = "Part"--i..", "..j
        part.Anchored = true
        part.CanCollide = true
        part.Size = Vector3.new(8,0.25,8)
        part.Position = Vector3.new(i*8, 0.125, j*8)

        print(region.Size)
        region.Size = part.Size
    end
end

The last line, region.Size = part.Size is throwing the error.

Answer this question