[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.
01 | local isMatchGoing = false |
03 | local players = game:GetService( "Players" ) |
08 | if not isMatchGoing and #players:GetPlayers() > 1 then |
09 | local random 1 = math.random( 1 ,#players:GetPlayers()) |
10 | local random 2 = math.random( 1 ,#players:GetPlayers()) |
11 | if random 1 = = random 2 then return end |
13 | local plr 1 = players:GetPlayers() [ random 1 ] |
14 | local plr 2 = players:GetPlayers() [ random 2 ] |
18 | local chr 1 = plr 1. Character or plr 1. CharacterAdded:Wait() |
19 | local chr 2 = plr 2. Character or plr 2. CharacterAdded:Wait() |
21 | chr 1. HumanoidRootPart.CFrame = workspace.start 1. CFrame |
22 | chr 2. HumanoidRootPart.CFrame = workspace.start 2. CFrame |
26 | died = chr 1. Humanoid.Died:Connect( function () |
28 | plr 2. leaderstats.Wins.Value = plr 2. leaderstats.Wins.Value + 1 |
37 | died 2 = chr 2. Humanoid.Died:Connect( function () |
39 | plr 1. leaderstats.Wins.Value = plr 1. leaderstats.Wins.Value + 1 |