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

[SOLVED] Why does this script's While True do stop working?

Asked by 5 years ago
Edited 5 years ago

The while true do stops working after a player wins a duel and because of that it doesn't start a new match. Sometimes it also doesn't even start a match and stops printing.

01local isMatchGoing = false
02 
03local players = game:GetService("Players")
04 
05    while true do
06            wait(1)
07            print(isMatchGoing)
08        if not isMatchGoing and #players:GetPlayers() > 1 then
09        local random1 = math.random(1,#players:GetPlayers())
10        local random2 = math.random(1,#players:GetPlayers())
11        if random1 == random2 then return end
12 
13            local plr1 = players:GetPlayers()[random1]
14            local plr2 = players:GetPlayers()[random2]
15 
View all 47 lines...
0
Try disconnecting both died and died2 in each connections above, see if it works! Afterl1ght 321 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I had a return in the loop

Ad

Answer this question