Still have questions? Join our Discord server and get real time help.
1

# [FIXED] (I cant keep the old title cuz of the character limit) ?

Edited 3 days ago

Hello. I am trying to make a Flood Escape style game where you try to escape rising lava. I've got the round system and rising part done, but the lava just stays where it is and you can't play again after that. I've tried reversing, which actually worked, but it won't come back up after that. I've tried multiple things, got 1 or 2 errors, and I'm stuck. The script you see here is my latest version. I'll add comments to help, somebody tell me how I fix this please. Thank You!

-- Setting variables
local Lava = script.Parent
local InRound = game.ReplicatedStorage.InRound

-- Making the rising tween
local Tween = game:GetService("TweenService")

local Info1 = TweenInfo.new(

20,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0

)

-- Making a draining tween (wouldve originaly not tweened it to drain it but I tried anyway)
local Info2 = TweenInfo.new(
5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)

-- Setting sizes
local TweenDo1 = {
Size = Vector3.new(45.4, 142.4, 52)
}
local TweenDo2 = {
Size = Vector3.new(45.4, 0.2, 52)
}

-- Setting tweens to play
local MWTween1 = Tween:Create(Lava, Info1, TweenDo1)
local MWTween2 = Tween:Create(Lava, Info1, TweenDo2)

-- Checking if the game has started
InRound.Changed:Connect(function()
print("Changed")
if InRound then
print("Lava Rising")
MWTween1:Play()
end
-- I originaly put something here to check if InRound is false to drain the lava, this didnt work so I tried something else
end)

-- I did this cuz I thought it might help
local X = 45.4
local Y = 142.4
local Z = 52

-- Lava drainer (FAILED)
while wait(3) do
-- I dont know if you need to use Vector3.new or not, if I dont use it i get an error though
if Lava.Size == Vector3.new(X, Y, Z) then
MWTween2:Play()
end
end



1
TGazza 205
2 days ago

Try:

-- Setting variables
local Lava = script.Parent
local InRound = game.ReplicatedStorage.InRound

-- Making the rising tween
local Tween = game:GetService("TweenService")

local Info1 = TweenInfo.new(
20,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0

)

-- Making a draining tween (wouldve originaly not tweened it to drain it but I tried anyway)
local Info2 = TweenInfo.new(
5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
)

-- Setting sizes
local TweenDo1 = {
Size = Vector3.new(45.4, 142.4, 52)
}
local TweenDo2 = {
Size = Vector3.new(45.4, 0.2, 52)
}

-- Setting tweens to play
local MWTween1 = Tween:Create(Lava, Info1, TweenDo1)
local MWTween2 = Tween:Create(Lava, Info1, TweenDo2)

-- Checking if the game has started
InRound.Changed:Connect(function()
print("Changed")
if InRound.Value then
print("Lava Rising")
MWTween1:Play()
end
end)

MWTween1.Completed:Connect(function(playbackState)
MWTween2:Play()

end)
MWTween2.Completed:connect(function(pbs)
InRound.Value = false
end)

while wait(3) do
if(InRound.Value == false) then
print("Waiting!")
end
end



I've made it automaticaly reset when it gets to the end of the 1st tween animation then when it gets back to its original size it turns off the round bool value for next time!

Hope this helps! :)

0
Oh Thanks! I never knew the changed event existed! This is VERY helpful! MrGustavio 29 — 2d
0
Completed not changed MrGustavio 29 — 2d