# How do I make a smooth transition between biomes changing?

Hello! I made a procedural terrain generation system, and I’m wondering how exactly I can smooth out… Well… This:

``````			if x % BiomeSize == 0 and z % BiomeSize == 0 then -- In this example it will pause after each 100 loops
if debounce == true then
debounce = false
print("Change biomes!")
currentBiome = Biomes[math.random(1, #Biomes)]
print(currentBiome)
wait(1)
debounce = true
end
end
``````

``````function module.GenerateTerrain()
if currentBiome == nil then
currentBiome = Biomes[math.random(1, #Biomes)]
end
for z = 1, Area2 do
for x = 1, Area2 do
local Brush = currentBiome:GetAttribute("Brush")
local ErosionScaleFactor = currentBiome:GetAttribute("ErosionScaleFactor")
local Foilage = currentBiome:GetAttribute("Foilage")
local Rocks = currentBiome:GetAttribute("Rocks")
local ScaleFactor = currentBiome:GetAttribute("ScaleFactor")
local Trees = currentBiome:GetAttribute("Trees")
local Ymultiplier = currentBiome:GetAttribute("Ymultiplier")
local ErosionY = Ymultiplier - math.random(-2, 2)
local Content = math.noise(x / ScaleFactor + ofsX, z / ScaleFactor + ofsZ, 0)
local Erosion = math.noise(x / ErosionScaleFactor + ofsX, z / ErosionScaleFactor + ofsZ, 0)
module.CreateVoxel(x * Ratio,(Content * (Ymultiplier * Ratio)) - (Erosion * (ErosionY * Ratio)), z * Ratio)

if x % ChunkSize == 0 then -- In this example it will pause after each 100 loops

end
local debounce = true
if x % BiomeSize == 0 and z % BiomeSize == 0 then -- In this example it will pause after each 100 loops
if debounce == true then
debounce = false
print("Change biomes!")
currentBiome = Biomes[math.random(1, #Biomes)]
print(currentBiome)
wait(1)
debounce = true
end
end

end
end
module.GenerateSealevel(58)
end

``````

Thanks,

• Luke
1 Like

Have you tried using TweenService?
`game:GetService("TweenService")`
TweenService | Roblox Creator Documentation

I have used it before but I don’t know how I would implement it.

I’m not that skilled with TweenService myself, sorry

I was looking into this at one point. Found information on YouTube in a video named: Biomes - Roblox Infinite Terrain Plugin. He modified the code to include Biomes. Also many other videos showing how they did this.

1 Like