Water Behaviour

Hi, I am looking for a way to manipulate water behavior.
Some context, I have a game with rooms in which there’s a brick called water which rises every second. There are different maps and the brick of water is inside the map, which is inside replicated storage until it is needed, cloned, and placed on the workspace.

What I want to achieve is better water, not just a brick. I like the Roblox terrain water, but I don’t see any way to manipulate it, as in storing it inside a model for cloning later, or for being able to rise it or lower it.

Is there any way to make this kind of water behavior or another way to generate water other than with the terrain editor?

And if not, is there a way to make fluids in Roblox? By fluids I mean, a fluid that moves like waves, not just a moving texture slammed into the top part of a brick.

Any help would be appreciated.

1 Like

If you have played Whatever Floats your Boat, i want to achieve something like that, where the water rises and falls, except that I also want it to be able to be stored in different models.
Ex. Water from map A should be stored inside Map A, and water from map B should be stored inside map B.

Hello. You can use that water brick to fill the room with water.

local water = workspace["Map A"].WaterPart -- example
workspace.Terrain:FillBlock(water.CFrame, water.Size, Enum.Material.Water)

You could even ignore the water part and just use position and size values depending on the map and the timer.

This code shouldn’t be a problem regarding performance if the volume to be filled is not huge and you are updating it every second as you said.

There are other ways to manipulate terrain, see them in this article: Terrain Editor | Documentation - Roblox Creator Hub

3 Likes

I’m pretty sure WFYB sinks the map into a stationary chunk of water, instead of the water actually rising, due to the limitations you’ve mentioned. It is possible to sort of ‘animate’ terrain water (or terrain in general) by deleting and creating it constantly, but I don’t think that’s very practical to do.

3 Likes

Yeah, I was just looking into that about filling blocks with terrain materials like water, but wouldn’t it be laggy if every second water is being created? And what would happen if the water is created in a place where water already exist? Would there be two waters? If that’s so then it would probably lag, as there would be like 2000 waters inside each other.

What other ways could there be of rising water or something that gives the apperance of water rising?

You could do the same thing that Whatever Floats Your Boat does, just on a smaller, per-room basis. One large block of water for the entire map, and then raising/lowering the rooms individually.

Deleted my last reply because I replied to the wrong person.

1 Like

Ok, that’s probably what I will end up doing thank you.

But, an other problem does arrise, not too much related to this but still kindof correlated.
What I wanted to do was to put a gui bar on the side of your screen which would represent the map. You player head would appear depending how high you are, and then a line would appear where the water level was at, and as the game went on and the water rose, that bar also rose, and therfor, the players seeked higher grounds, making their heads go even higher.

Thing is, if I do this, the water level would always stay the same, so how would I go about to recreate the same mechanic with the water rising on the bar when it actually isnt?

That’s not how Roblox terrain works, don’t worry! Waters won’t add up just like two parts with the same position. If a voxel is completely filled with water (or any other material), its occupancy will be 1, which is the maximum value regardless of how many times you perform this operation.

If you really think this method will cause lag, you could try to implant this system with a map prototype and use Studio performance tools to study it.


About the problem about the gui bar, if you prefer to sink the room rather than leveling the water, consider the position of a certain part of the map (e.g., its root part). The Y component of the position will be constantly decreasing n studs per second. If you raised the water instead, its leveling rate would be exactly the opposite number. Just change the sign, and you’ll have solved the problem!

2 Likes

Thank you very much!
I will definitely try both approaches to sinking the ground and placing water.

1 Like

You could take an insensible part anchored to the bottom of the room that moves along with the room. Then, you use the part’s Y value to set the position of the player’s head on the GUI.