Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My script doesn't stop the water from raising?

Asked by 3 years ago

So basically when the InRound bool val turns false it doesn't break the loop and there is no errors in da output here is da script btw:

local Water = workspace.Water
local InRound = game.ReplicatedStorage.InRound.Value
while true do
    if InRound == false then 
        break 
    end
    wait(.5)
    Water.Position = Water.Position + Vector3.new(0,1,0)
end




1 answer

Log in to vote
0
Answered by 3 years ago

The variable InRound is equal to the current boolean value of InRound, but does not actually keep a reference to the object, meaning the variable InRound will remain the same whether or not the value of the object changes. Change line 2 to:

local InRound = game.ReplicatedStorage.InRound

And line 4 to:

if InRound.Value == false then
Ad

Answer this question