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

How does one add a boolvalue variable in a while true do loop?

Asked by 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
Technovalley = 0
while wait() do
    Technovalley + 1
    if Technovalley == 5 then
        return end
    end
end
0
what does this even mean explain yourself ihatecars100 502 — 5y
0
I think he wants to add + 1 using a loop, if that's what he means then you should do Technovalley = Technovalley + 1 (sorry if that's not what you mean.) utrabem 5 — 5y

1 answer

Log in to vote
3
Answered by
Rheines 661 Moderation Voter
5 years ago
Edited 5 years ago

I don't think you mean Bool values, as those are just either values that equates to true or false. Rather, I think you mean you need help adding with the "Technovalley" variable, which holds an integer. Also, you cannot use return to go out of the loop, as it only works for functions. You need to use break.

To add to that variable, all you need to do is:

local Technovalley = 0
while wait() do
    --To add to a variable, do this:
    Technovalley = Technovalley + 1
    if Technovalley == 5 then
        break
    end
end
0
This is why you don't use `while wait() do`. That could easily be shortened as `while Technovalley ~= 5 do`. ee0w 458 — 5y
0
That is also true, however I am only fixing with what the OP has originally. Rheines 661 — 5y
2
`while wait() and Technovally < 5 do ... end` @0x ScriptGuider 5640 — 5y
2
you could just use a numeric for loop for this purpose :p theking48989987 2147 — 5y
Ad

Answer this question