zkPkwDAF
zkPkwDAF
zkPkwDAF
local queuedPlayers = {}
local activePlayers = {}
players.PlayerAdded:Connect(queuePlayers)
queuePlayers()
while true do
for i, plr in pairs(players:GetPlayers()) do
local userId = plr.UserId
local diedConnection
diedConnection = humanoid.Died:Connect(function()
removePlayer(plr)
diedConnection:Disconnect()
end)
end
end
if #activePlayers == 1 then
local winner = players:GetPlayerByUserId(activePlayers[1])
print(winner.Name, "has won!")
task.wait(5)
winner.Character.HumanoidRootPart.CFrame =
workspace.SpawnLocation.CFrame + Vector3.new(0,5,0)
winner.leaderstats.Wins.Value += 1
gameActive.Value = false
CheckForPlayers()
break
end
task.wait(1)
end
end
countingDown.Changed:Connect(function()
if countingDown.Value == true then
for i=config.countdownTime,0,-1 do
countingDown.Value = false
gameActive.Value = false
updateText("", false)
print("Countdown ended")
gameStart()
end
end)
CheckForPlayers()
players.PlayerRemoving:Connect(removePlayer)
-- Config
local config = {
MinimumPlayers = 1;
countdownTime = 15;
}
return config
-- leaderstats
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
end)
-- local script