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

Why doesn't my repeat stop after it reaches it's goal?

Asked by 4 years ago

Issue

The issue is quite simple, the repeat doesn't stop when it reaches my desired goal. The Volume Default Value is 1. It starts at 0 and slowly rises.

The Error part of the script

        repeat 
            Audio.Volume = Audio.Volume + 0.1
            wait(0.5)
        until Audio.Volume == Volume

2 answers

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

Have you tried '>='? The issue could be that it's going over your Volume value and therefore it's never going to be equal to Volume. Using '>=' (Over or equal) will detect if it is either over, or equal to Volume. If it is, then it will stop the Loop.

repeat 
    Audio.Volume = Audio.Volume + 0.1
    wait(0.5)
until Audio.Volume >= Volume
0
Nice explanation Nguyenlegiahung 1091 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I think you should change == to >= for it to work

repeat
        Audio.Volume = Audio.Volume + 0.1
        wait(0.5)
    until Audio.Volume >= Volume

Answer this question