local replicatedstorage = game:GetService('ReplicatedStorage')
local status = replicatedstorage:WaitForChild('InfoValue')
local mapstorage = game.Workspace:WaitForChild('mapStorage')
while true do
while game.Players.NumPlayers < 2 do
status.Value = 'Waiting for players, invite your friends!'
repeat wait(2) until game.Players.NumPlayers >= 2
end
for i = 60,0,-1 do
status.Value = 'Intermission: '..i
wait(1)
end
_G.gameplayers = {}
for i, v in pairs(game.Players:GetPlayers()) do
if v then
table.insert(_G.gameplayers, v.Name)
end
end
local mapsinserverstorage = game:GetService('ServerStorage').Maps:GetChildren()
local chosenmap = mapsinserverstorage[math.random(1,#mapsinserverstorage)]
chosenmap:Clone().Parent = mapstorage
status.Value = 'The Game is starting!'
wait(1)
local spawns = chosenmap:WaitForChild('Spawns'):GetChildren()
for _, player in pairs(game.Players:GetPlayers()) do
if player and #spawns > 0 then
local torso = player.Character:WaitForChild('Torso')
local allspawns = math.random(1, #spawns)
local randomspawn = spawns[allspawns]
if randomspawn and torso then
table.remove(spawns, allspawns)
torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
local sword = game.ServerStorage.Sword
local newsword = sword:Clone()
newsword.Parent = player.Backpack
end
end
end
for i = 300,0,-1 do
if i == 0 then
status.Value = 'Time is up!'
break
end
wait(1)
if #_G.gameplayers == 1 then
for i, v in pairs(_G.gameplayers) do
if v ~= nil then
status.Value = v..' is the winner!'
EarnedCoins=math.random(1,100)
EarnedExp=math.random(1,100)
game.Players[v].leaderstats.Coins.Value = game.Players[v].leaderstats.Coins.Value +EarnedCoins
wait(0.1)
game.Players[v].leaderstats.Exp.Value = game.Players[v].leaderstats.Exp.Value +EarnedExp
break
end
end
break
else
status.Value = i..' seconds left!'
end
end
mapstorage:ClearAllChildren()
wait(5)
end
COMMUNITY QUESTION
How do i make a player get ignored by the match script if he has pressed the afk button?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
The "repeat wait(2) until game.Players.NumPlayers >= 2" isn't necessary, you can replace it with wait(2)
Did i asked for that?
Do you even English?