"Size cannot be assigned to" error while creating parts via script

I am trying to generate terrain via Diegnified’s Perlin Noise Library Module and after getting it to work, I get the error 15:51:16.824 - Size cannot be assigned to which I wouldn’t get previously. The line that is causing this is currentpart.Size = Vector3.new(2,5,2).

The whole script is:

local PerlinNoise = require(game.ServerStorage.PerlinNoise) -- Where the module script is.

local size = 100
local amplitude = 35
local octaves = 1
local height = 10

workspace.Baseplate.Transparency = 1 -- Making the baseplate transparent just so it isn't in the way of the generated terrain.

for x = 1,size,1 do
   for y = 1,size,1 do
      local currentpart = Instance.new("Part")
      currentpart = Vector3.new(x*2,PerlinNoise.new({x,y},amplitude,octaves,0.5)*height,y*2) -- This is where the actual module is used.
      currentpart.Size = Vector3.new(2,5,2) -- 15:51:16.824 - Size cannot be assigned to
      currentpart.Anchored = true
	  currentpart.BrickColor = BrickColor.new("Camo")
	  currentpart.Material = "Grass"
      currentpart.Parent = workspace.TerrainBlocks -- TerrainBlocks is a model I made to hold the blocks that are created.
   end
end
2 Likes

You reassigned a Vector3 to your currentpart variable.

3 Likes

You forgotten to add the position, heres a fix:

I tried to turn it into terrain instead of parts and I guess I forgot to fix this.