This script is just a draft.
I am receiving this error Argument 1 missing or nil for line 41
local waitingforplayerstime = 20
local waitingforplayers = waitingforplayerstime -- for consistency throughout script
local intermission = 5
local matchtime = 120 -- 2 minutes
local numofplayers = 0
local maxplayers = 3 -- max number of players in game
local ss = game:WaitForChild("ServerStorage") --Use waitforchild to prevent errors
local rs = game:WaitForChild("ReplicatedStorage")
local events = {}
local players = game:WaitForChild("Players")
players.PlayerAdded:connect(function()
print("PlayerAddedTest Passed")
print(numofplayers)
numofplayers = numofplayers + 1
print(numofplayers)
wait(1)
initiatematch()
end)
players.PlayerRemoving:connect(function()
print("PlayerRemovedTest Passed")
numofplayers = numofplayers - 1
end)
function initiatematch()
if numofplayers > 1 then
while waitingforplayers > 0 do
waitingforplayers = waitingforplayers - 1
print(waitingforplayers)
if numofplayers < 2 then
waitingforplayers = waitingforplayerstime -- stop the deployment of players if there is only 1 player in-game
break
end
end
if waitingforplayers <= 0 then
game.ReplicatedStorage.TeamColor:FireClient() -- error here
end
end
end
The script is located in serverscriptservice The client event being fired is located in playerscripts The code for the client event is just a print statement to make sure the event has fired and been received. FE is not enabled.

1 comment
I ended up not using an event at all but this does work. I figured out that I could set the players TeamColor in a ServerScript and didn't need an event at all. Thanks anyway.