1 main problem
- it stops working due to the break on the main script
working on a round script here is my main script(script In scs)
local round = require(script.Round)
local info = game.ReplicatedStorage:WaitForChild("Info")
local Message = info:WaitForChild("Message").Value
local Inround = info:WaitForChild("InRound").Value
local maps = game.Workspace:WaitForChild("Maps"):GetChildren()
local lobby = workspace.Lobby
local playersinRound = {}
repeat
local map = maps[math.random(1, #maps)]
print(map)
for intermission = 5,0,-1 do
print("Game Starting In ", intermission)
if intermission == 0 then
round.SpawnPlayers(map)
end
for i, player in ipairs(game.Teams.Playing:GetPlayers()) do
table.insert(playersinRound, player.Name)
if #playersinRound >= 2 then
return
elseif #playersinRound == 1 then
local playerwhowon = playersinRound[1]
print(playerwhowon, "Is The Winner!!")
wait(1)
round.ReturnPlayers(lobby)
break
end
end
task.wait(1)
end
for Round = 5,0,-1 do
print("Game Ending In ", Round)
if Round == 0 then
round.ReturnPlayers(lobby)
Message = "Nobody Won D:"
task.wait(1.5)
Message = "Game Ended!"
end
task.wait(1)
end
until Message == "Idk"
here is my module script in the main script
local inround = game.ReplicatedStorage:WaitForChild("Info"):WaitForChild("InRound").Value
local message = game.ReplicatedStorage:WaitForChild("Info"):WaitForChild("Message").Value
local maps = game.Workspace:WaitForChild("Maps"):GetChildren()
local playersinRound = {}
local round = {}
function round.SpawnPlayers(map)
if inround then
return nil
else
inround = true
for i, player in ipairs(game.Players:GetPlayers()) do
local char = player.Character
local humrp = char:WaitForChild("HumanoidRootPart")
humrp.CFrame = map.CFrame
player.Team = game.Teams.Playing
end
end
end
function round.ReturnPlayers(lobby)
if inround then
inround = false
for i, player in ipairs(game.Players:GetPlayers()) do
local char = player.Character
local humrp = char:WaitForChild("HumanoidRootPart")
humrp.CFrame = lobby.CFrame
player.Team = game.Teams.Watching
end
end
end
function round.FindWinner()
for i, player in ipairs(game.Teams.Playing:GetPlayers()) do
table.insert(playersinRound, player.Name)
if #playersinRound > 1 then
return
elseif #playersinRound == 1 then
local playerwhowon = playersinRound[1]
end
end
end
return round
here is what it does game