Ad
Log in to vote
0

Why doesn't While true do loop forever?

Asked by 19 days ago

That's my script

local TimeValue = script.Parent.Parent.Values.Time
local PlayersValue = script.Parent.Parent.Values.Players
local BoatValue = script.Parent.Parent.Values.BoatReady

while true do
    print("script starts working again!")
    repeat
        wait(1)
    until BoatValue.Value == true
        TimeValue.Value = 20
        repeat
            TimeValue.Value = TimeValue.Value - 1
            wait(1)
        until TimeValue.Value == 0
        if PlayersValue.Value ~= 0 then
            BoatValue.Value = false
            repeat
                script.Parent.Transparency = script.Parent.Transparency + 0.01
                wait(0.01)
            until script.Parent.Transparency == 1
            wait(10)
        end 
    print("the end of the script, it should actually work again")
    wait()
end

It does everything without errors, warnings, or anything. It works fine, until the end. When it finishes, it doesn't repeat. How to fix this?

1 answer

Log in to vote
0
Answered by 19 days ago
Edited 19 days ago
repeat
    script.Parent.Transparency = script.Parent.Transparency + 0.01
    wait(0.01)
until script.Parent.Transparency == 1

These lines have already been executed , try reverting the changes done by the script at the start of the while loop before adding the rest of the lines. let me know if the transparency gets reset because I do not see the line of code where the transparency gets reset

0
There wasn't anything like that yet fellix_yt 5 — 19d
Ad

Answer this question