Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to animate water?

I'm trying to make a brick move left and right in water like motion. How can I script that?

4 answers

You can make a Part move smoothly backwards and forwards in a multitude of different ways, how close they are to approximating water all depends on what movement of water you're talking about and which method you use.

I'll describe one method that you can use to get the Part moving smoothly backwards and forwards:

First, have a look at the graph of the function sin^2(x):

http://www.wolframalpha.com/input/?i=y+%3D+sin%5E2%28x%29

Now in Roblox Lua you can use the math library to access some mathematical functions, then all you need to do is link the output from this function (over time) to the movement of your brick.

So lets start with a while loop:

while wait() do
--Process the movement here
end

... and fill the rest in:

brick = workspace.Blue --The part you want to animate

center = brick.Position --We want the brick to stay oscillating around a centre point

multiplier = 1 --How fast you want it to go back and forth

distance = 5 --How many studs you want the brick to move by each way

while wait() do
--This will move the brick in the +/- x-axis direction
brick.CFrame = CFrame.new(5 * (math.sin(multiplier*tick()))^2,0,0) + center
end

... I think it looks quite nice!

I hope that gets you started with what you were looking for.

you could just make a script to rotate the water making it move.

hope this helped!

U dont need to animate water u can use stamper tools water its like animated

1 comment

0

I wanted a brick movement not using the roblox stamper tool because it doesn't have the desire texture I needed from it.

You could go on Roblox studio and play around with the tools till you find the water terrain.There are 2 types one which is only for BC or as Builderkevin25 said use the stamper tool

This discussion is preserved as it was. New answers, comments, and votes are closed.