I used tween Service at first with a part but I didn’t really like it at all and I had the idea of using the terrain for the water physics and the possibility of swimming but I haven’t been able to make the transition as clean as tween does, not even with the help of AI. If someone has a way to achieve this I would be very grateful.
-- Configuración inicial
local centerPosition = Vector3.new(-70.225, 1.9, 196.128)
local fullSize = Vector3.new(424.668, 39.365, 257.769)
local material = Enum.Material.Water
local voxelResolution = 4 -- Resolución estándar del vóxel en Roblox
local steps = 200 -- Número de pasos para una transición más suave
local duration = 10 -- 10 segundos
-- Función para ejecutar el "crecimiento" del terreno de agua
local function playBloxyColaTween()
-- Limpiar cualquier terreno existente en la región
local region = Region3.new(
centerPosition - fullSize / 2,
centerPosition + fullSize / 2
)
region = region:ExpandToGrid(voxelResolution)
Terrain:ReplaceMaterial(region, voxelResolution, material, Enum.Material.Air)
-- Animación de crecimiento con más pasos
local startTime = tick()
local connection
local function updateHeight()
local elapsed = tick() - startTime
local progress = math.min(elapsed / duration, 1)
local currentHeight = fullSize.Y * progress
local region = Region3.new(
centerPosition - Vector3.new(fullSize.X / 2, currentHeight / 2, fullSize.Z / 2),
centerPosition + Vector3.new(fullSize.X / 2, currentHeight / 2, fullSize.Z / 2)
)
region = region:ExpandToGrid(voxelResolution)
-- Limpiar la región completa y aplicar agua solo en la altura actual
local fullRegion = Region3.new(
centerPosition - fullSize / 2,
centerPosition + fullSize / 2
)
fullRegion = fullRegion:ExpandToGrid(voxelResolution)
Terrain:ReplaceMaterial(fullRegion, voxelResolution, material, Enum.Material.Air)
Terrain:ReplaceMaterial(region, voxelResolution, Enum.Material.Air, material)
if progress < 1 then
task.wait(duration / steps) -- Dividir en pasos para suavizar
else
if connection then
connection:Disconnect()
end
end
end
connection = RunService.Heartbeat:Connect(updateHeight)
end