Below I have a script that ends the game depending on the circumstances.
A Murderer is chosen, all players are teleport-ed to the map and it begins. All the players other than the murderer are put into a table called _G.AllPlayers and once a player dies they get removed from the table. The problem is, as soon as the game starts it says the murderer is victorious...
Please help I literally don't know what's wrong with it.
repeat
wait(1)
GameTime = GameTime - 1
game.ServerScriptService.LightsOutPerk.Disabled = false
CountDown:FireAllClients('StartCountDown',GameTime.." SECONDS REMAINING")
while true do
if _G.Murderer == nil and #_G.AllPlayers > 0 then
win = 3
break
elseif _G.Murderer == nil and #_G.AllPlayers == 0 then
win = 2
break
elseif _G.Murderer and #_G.AllPlayers == 0 then
win = 1
break
elseif GameTime == 0 then
win = 3
break
end
end
until win == 1 or win == 2 or win == 3
