Nevermind, I found a way to fix, I changed to method, thanks for trying to help.
Video
Final Code:
03 | local prefabStorage = game:GetService( "ReplicatedStorage" ) |
06 | [ "Grass" ] = prefabStorage:WaitForChild( "Grass" ) |
12 | local chunkSize = Vector 3. new(chunkX,chunkY,chunkZ) |
17 | local chunkPos = Vector 3. new(chunkPosX,chunkPosY,chunkPosZ) |
21 | local Seed = math.random( 1 , 10000000 )/ 100 |
26 | local function createChunk(chunkP) |
27 | local primarySelected = false |
29 | local chunkGroup = Instance.new( "Model" ) |
30 | chunkGroup.Name = "Chunk" ..chunkNumber |
31 | chunkGroup.Parent = game.Workspace.Terrain |
33 | chunkP = chunkP * chunkSize |
35 | for x = chunkP.X,chunkX + chunkP.X do |
36 | for y = chunkP.Y,chunkY + chunkP.Y do |
37 | for z = chunkP.Z,chunkZ + chunkP.Z do |
38 | local noiseX = math.noise(y/noiseScale,z/noiseScale,Seed) * Amplitude |
39 | local noiseY = math.noise(x/noiseScale,z/noiseScale,Seed) * Amplitude |
40 | local noiseZ = math.noise(x/noiseScale,y/noiseScale,Seed) * Amplitude |
42 | local Density = noiseX + noiseY + noiseZ + y |
45 | local Block = Prefabs.Grass:Clone() |
46 | Block.Parent = chunkGroup |
47 | Block.Position = Vector 3. new(x*Block.Size.X,y*Block.Size.Y,z*Block.Size.Z) |
49 | if not primarySelected then |
50 | chunkGroup.PrimaryPart = Block |
51 | primarySelected = true |
57 | chunkNumber = chunkNumber + 1 |
64 | createChunk(Vector 3. new(i, 0 ,v)) |