i actually found multiple mistakes here, but dont worry.
first, you only made Tween3. Calling Tween11 or Tween4 when they dont exist will error your code.
second, you only defined position once, so calling tween3 continuously would just teleport your water to that originally defined position
heres an explanation on how I would code this (takes like 5min to code)
find your object
run a while-loop on it that waits the tween duration
run a new position tween inside the loop that is x higher from waters old height
heres a code snippet, you can see it follows the steps
local waterObject = game.Workspace:WaitForChild("Water") -- ensure we load the water
local tweenTime = 0.5 -- we use this in many places, so its easier to edit all those times here
local tweenInfo = TweenInfo.new(
tweenTime,
Enum.EasingStyle.Quart,
Enum.EasingDirection.Out
)
while wait(tweenTime) do
local tweenGoal = {Position = waterObject.Position + Vector3.new(0,5,0)}
local myTween = game:GetService("TweenService"):Create(waterObject, tweenInfo, tweenGoal)
myTween:Play()
end
additionally i forgot to say, while loop can be put into coroutine or spawn so it wont stop the rest of script if stuff is added after the while loop, like so
spawn(function()
-- while loop goes here
end)
coroutine.wrap(function() -- better for long-term learning than spawn
-- while loop goes here
end)() -- parentheses run the wrap function so we dont need to define it
Oops! I forgot about the nonexistent tweens. In the real code, they’re all gonna play Tween3, which doesn’t work.
Also, thanks for your response! The output I want is gonna have an interval, which goes with 0.4, 0.4, 0.4, 0.3 wait functions, while it continuously rises.
Don’t understand properly? Basically, it’s an inspiration from the Flood Escape 2 Community Map “Technological Destruction”.
Here’s a video reference on what I expect for the output to be, start at 0:50 to see what I mean.
Applying the knowledge from Onebeets’s code, I made this:
while true do
local tweenGoal = {Position = Water._Water1.Position + Vector3.new(0,5,0)}
local myTween = TweenService:Create(Water._Water1, TweeningInfo3, tweenGoal)
myTween:Play()
Interval = Interval + 1
if Interval ~= 4 then
wait(0.4)
print("Interval " ..Interval)
elseif Interval == 4 then
wait(0.5)
Interval = 0
print("Interval RESET")
end
end
And in the future, I will be using the coroutine function soon. Thanks for helping!