I have a game loop which starts and ends rounds etc and ends rounds based on a timer which was ticking down which looks like:
if #plrs == 0 then
Status.Value = ""
break
elseif i == 0 and game.ServerStorage.team1points > game.ServerStorage.team2points then
Status.Value = "Team 1 wins"
break
elseif i == 0 and game.ServerStorage.team1points < game.ServerStorage.team2points then
Status.Value = "Team 2 wins"
break
however I want to be able to also end the rounds based on x team reaching x amonut of points, so I set up another script which follows the value of both teams points and once one reaches the x amount of points it changes a string value to the winning team.
So now I need to be able to check this value so when it gets changed the main script can follow and end the round however having a .Changed function would break the loop and putting the loop inside the .Changed function breaks a few global variables so im wondering what the best way to do this would be.
Ideally this is how it would look following on from the previous lines of code:
elseif val == "a" then
Status.Value = "Team 1 wins!"
break
elseif val == "b" then
Status.Value = "Team 2 wins!"
break
end
With val being the stringvalue in storage which gets changed to the winning team