So earlier I asked a question about my round system code saying that it isn't functional. Later on I got at least 2 responses about it, but it's still not working.
I was wondering if someone could check my code and see if there is a way to fix it. Thank you if you do! (If you can, please also show me a where I fix the code in Lua.)
function playerNotification(Text)
for _,v in pairs (game.Players:GetChildren()) do
local textLabel = v.PlayerGui:FindFirstChild("ScreenGui")
if textLabel then
textLabel.Frame.TextLabel.Text = Text
end
end
end
function waitForPlayers()
while game.Players.NumPlayers < 2 do
playerNotification("You need 1 more player to start the game.")
end
end
function intermissionTimer()
if game.Players.NumPlayers > 2 then
for countDown = 10, 1, -1 do
playerNotification("Intermission: " ..countDown)
end
end
function displayGamemode()
end
function mapSelection()
local mapList = game.ReplicatedStorage.Maps:GetChildren()
local randomMap = math.random(1, #mapList)
playerNotification("Choosing the map!")
wait(4)
local mapChosen = mapList[randomMap]
playerNotification("The map is: " ..mapChosen.Name)
local mapClone = mapChosen:Clone()
mapClone.Parent = game.Workspace
end
function teleportAllPlayers()
local target = CFrame.new(workspace.SpawnLocation.Position)
for i, player in ipairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
player.Playing.Value = 1
end
end
function startingTimer()
for countDown = 3, 1, -1 do
playerNotification("Game begins in: " ..countDown)
end
end
function roundTimer()
for countDown = 20, 1, -1 do
playerNotification("Time left: " ..countDown)
end
end
function roundEnded()
end
function teleportAlivePlayers()
local target = CFrame.new(workspace.TeleportTarget.Position)
for i, player in ipairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
player.Playing.Value = 0
end
end
function mapDestroy()
end
function showResults()
end
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
player.Playing.Value = 0
end)
end)
local playing = Instance.new("IntValue", player)
playing.Value = 0
playing.Name = "Playing"
end)
while(true) do
waitForPlayers()
wait(0)
intermissionTimer()
wait(0)
displayGamemode()
wait(5)
mapSelection()
wait(5)
teleportAllPlayers()
wait(0)
startingTimer()
wait(0)
roundTimer()
wait(0)
roundEnded()
wait(0)
teleportAlivePlayers()
wait(0)
mapDestroy()
wait(0)
showResults()
end
end

1 comment
You aren't providing the point where the script errors. Also, if you ask a question in this way, everyone is open to answer - don't mention specific ones.