Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

One player left end game please help?

Asked by 7 years ago
    randomMap = game.Workspace:WaitForChild("mapStorage"):GetChildren()

local replicatedstorage = game:GetService('ReplicatedStorage') local status = replicatedstorage:WaitForChild('infovalue') while wait() do if game.Players.NumPlayers > 1 then for i = 50, 0, -1 do status.Value = "Intermission time: "..i wait(1) end status.Value = "Intermission over, Get ready!" wait(2) status.Value = "Picking an Arena" ranmap = math.random(1, #randomMap) mapChos = randomMap[ranmap] wait(2) status.Value = "Arena Chosen: "..mapChos.Name wait(3) mapChosen = mapChos:Clone() mapChosen.Parent = game.Workspace spawns = mapChosen.Spawns:GetChildren() for i,v in pairs(game.Players:GetPlayers()) do Humanoid = v.Character.Humanoid if Humanoid then v.Character:MoveTo(spawns[i].Position) Sword = game.ReplicatedStorage.ClassicSword:Clone() Sword.Parent = v.Backpack end end status.Value = "Sword Match in Progress" wait(40) status.Value = "Great Job!" wait(2) mapChosen:Destroy() for i,v in pairs(game.Players:GetPlayers()) do HumanoidL = v.Character.Humanoid if HumanoidL then v.Character:breakJoints() end end mapChosen:Destroy() else status.Value = "There needs to be 1 or more players to play"
end end

It works but what I want it to do is say that theres 3 players in a game in the map, wat if 2 die and theres one left? it still waits the 40 seconds, but wat i want it to do is end the match. Can anyone help?

0
You would have to keep all the players in a table and keep track of who dies, and remove them from that table. Once the #TableName == 1, then end the game dragonkeeper467 453 — 7y
0
^ so i make a folder? and how exactly would i script the table? im new so yeah.. TheOwlFromSaturn 26 — 7y

Answer this question