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

How do i repeat?

Asked by 8 years ago

Do i need to put the hole thing in () or is there like a different way? I dont understand it or do it just leave repeat?

1 answer

Log in to vote
0
Answered by
Vezious 310 Moderation Voter
8 years ago

Lets say you want to repeat something until it's not the same thing.

So you have 2 maps. You Don't want the repetition of the same map. So there is a variable that holds the name of the last map. In this case it's Map2. So we need to get Map1. Here is how you make sure it get's map1.

LastMap = "Map2"

while true do
local Maps = {Map1,Map2}
local NextMap = ""
repeat
NextMap = Maps[math.random(1, #Maps)]
until NextMap ~= LastMap

So you have a map picker that repeats the process until you have a map that wasn't played last round. There are plenty more things repeat can be used for.

Ad

Answer this question