Im making a game and Im trying to make a script so when two people join the game will start, but its not working. Heres the script:
function Countdown()
local time = 10
local h = Instance.new("Message",Workspace)
for i = time , 1, -1 do
wait(1)
h.Text = ""..i.." Seconds"
end
wait(1)
h.Text = ""..i.." Seconds"
end
game.Players.PlayerAdded:connect(function(plr)
if NumPlayers == 1 then
a = Instance.new("Hint",Workspace)
a.Text = "One more player needed!"
elseif NumPlayers == 2 then
a.Text = "Starting game!"
wait(1)
game.Workspace.Message:Destroy()
Countdown()
end
end)

1 comment
Define NumPlayers. NumPlayers = game.Players.NumPlayers