I'd like help on techniques, and how to clone maps into the game, and how to respawn players?
This is the script: -- If there's any problems please tell me
while true do A = game.Players if A.NumPlayers == 1 then print("There's not enough players in the game for the game to start.") A1 = "This service is unavailable, please wait until 1 more player joins..." A2 = "Welcome to the official meadows sfing game" A4 = "5" A3 = "The amount of players is successful, and the game will be starting in" .. A4 .. "Seconds.." A5 = "Teaming players..." A6 = "Blue team has won" A7 = "Red team has won" local M = Instance.new("Message",workspace) elseif A.NumPlayers > 1 then print(NumPlayers.." Is the amount of players in the game.") wait(0.1) if A.NumPlayers == NumPlayers >2 then print("Success") wait(3) elseif A.NumPlayers == NumPlayers <1 then repeat wait(3) M.Text = A1 wait(1) M:Destroy() wait(1) local M = instance.new("Message",workspace) until A.NumPlayers == NumPlayers >1 end wait(5) if M == nil then print("Need to create message") local M = instance.new("Message",workspace) elseif M == not nil then print("Moving on") M.Text = A2 wait(1) M.Text = A3 wait(0.1) function fixTeams() BlueTeam = clones[1].Parent == game.Teams -- This is the blue team RedTeam = clones[2].Parent == game.Teams -- This is the red team end wait(3) M.Text = A5 function checkSpectators() spectators = 0 for _, player in pairs(game.Players:GetChildren()) do if player.TeamColor == game.Teams.Spectators.TeamColor then spectators = spectators + 1 end end if(spectators == A.NumPlayers) then BlueTeam:Destroy() RedTeam:Destroy() Wait(3) function findwinner() redplayers = 0 blueplayers = 0 BlueTeam = game.Teams.BlueTeam.TeamColor RedTeam = game.Teams.BlueTeam.TeamColor for _, player in pairs(game.Players:GetChildren()) do if player.TeamColor == game.Teams.BlueTeam.TeamColor then players = redplayers + 1 and blueplayers + 1 wait(5) if blueplayers == 0 then print("Blue team has lost") M.Text = A7 elseif player.TeamColor == game.Teams.RedTeam.TeamColor then if redplayers == 0 then print("Red team has lost") M.Text = A6 fixteams() checkspectators() findwinner() end end end end end end end end end end
Here, I edited your script, I edited as best I could, but I could not understand most of the coding/what you were trying to do, so I edited what I thought you were trying to do, and tried my best.
--I edited as best I could, but I could not understand most of the coding/what you were trying to do, so I edited what I thought you were trying to do repeat wait(0)until game:FindFirstChild("Teams") local NumPlayers = 2 --Change this to the number of players needed local A = game.Players local A1 = "This service is unavailable, please wait until 1 more player joins..." local A2 = "Welcome to the official meadows sfing game" local A4 = "5" local A3 = "The amount of players is successful, and the game will be starting in" .. A4 .. "Seconds.." local A5 = "Teaming players..." local A6 = "Blue team has won" local A7 = "Red team has won" local BlueTeam = game.Teams:WaitForChild("BlueTeam") local RedTeam = game.Teams:WaitForChild("BlueTeam") local redplayers = 0 local blueplayers = 0 local M = Instance.new("Message") local TimeForLoop = .5 --This will loop the script every .5 seconds local players = 0 local GameRun = false function fixTeams() BlueTeam:Clone().Parent = game.Teams -- Whats 'clones[1]'? RedTeam:Clone().Parent = game.Teams -- Whats 'clones[2]'? end function checkSpectators() spectators = 0 for _, player in pairs(game.Players:GetChildren()) do if player.TeamColor == game.Teams.Spectators.TeamColor then spectators = spectators + 1 if(spectators >= NumPlayers) then BlueTeam:Destroy() RedTeam:Destroy() wait(3) end end end end function findwinner() for _, player in pairs(game.Players:GetPlayers()) do if player.TeamColor == BlueTeam.TeamColor then players = blueplayers + 1 wait(5) if blueplayers == 0 then print("Blue team has lost") M.Text = A7 elseif player.TeamColor == RedTeam.TeamColor then players = redplayers + 1 if redplayers == 0 then print("Red team has lost") M.Text = A6 end end end end end function StartGame() if GameRun then fixteams() checkspectators() findwinner() end end while wait(TimeForLoop)do if A.NumPlayers >= NumPlayers then GameRun = true StartGame() else GameRun = false print("There's not enough players in the game for the game to start.") repeat wait(0)until A.NumPlayers >= NumPlayers end end
Sorry if this wasn't helpful. :(