Bad argument materials to 'WriteVoxels' (2x1x1 array expected) what did i do wrong?
im making a pickaxe that isn't working because i keep getting the error:
Bad argument materials to 'WriteVoxels' (2x1x1 array expected)
full code
04 | script.Parent.Equipped:connect( function (m) |
08 | local function create 3 dTable(size) |
19 | local material = create 3 dTable(Vector 3. new( 1 , 1 , 4 )) |
20 | material [ 1 ] [ 1 ] [ 1 ] = Enum.Material.Air |
21 | material [ 1 ] [ 1 ] [ 2 ] = Enum.Material.Air |
22 | material [ 1 ] [ 1 ] [ 3 ] = Enum.Material.Air |
23 | material [ 1 ] [ 1 ] [ 4 ] = Enum.Material.Air |
25 | local occupancy = create 3 dTable(Vector 3. new( 1 , 1 , 4 )) |
31 | script.Parent.Activated:connect( function () |
32 | if not debounce and mouse.Target = = game.Workspace.Terrain then |
33 | if (script.Parent.Handle.Position - mouse.Hit.p).magnitude < 10 then |
34 | local region = Region 3. new(mouse.Hit.p, mouse.Hit.p+Vector 3. new( 1 , 1 , 1 )) |
35 | region = region:ExpandToGrid( 4 ) |
36 | game.Workspace.Terrain:WriteVoxels(region, 4 , material, occupancy) |