##Problems
In the ServerScript, there is a part named ExitRegion listening to the Touched event.
When there are 2 or more players and they touch, they occasionally teleport. It would freeze the screen for a second if it worked. It wouldn't And to actually get out(the last iteration was supposed to do that), you have to reset.The while loop that checks if the length of the inRound array is 0, it just breaks and continues on(and doesn't teleport). Plus when touching the ExitRegion, there is a :FireClient() method. It works with GUI's. It does work but the recurse() function I have. It doesn't disable the scripts found. There are no errors in the output.
##Code
ServerScript in ServerScriptService
--\\ Services
local repStorage = game:GetService("ReplicatedStorage")
--\\ Network Data
local exitRemote = repStorage:WaitForChild("ExitRemoteEvent")
local resetLighting = repStorage:WaitForChild("LightingRemoteEvent")
local inRound = {}
local finished = {}
local participating = game.Players:GetPlayers()
for index,plr in pairs(participating) do
print("Inserted a player in the inRound array")
inRound[#inRound + 1] = plr.Name
local foundPlayer = players:WaitForChild(plr.Name)
local char = game.Workspace:WaitForChild(foundPlayer.Name) or foundPlayer.Character
local hum = char:WaitForChild("Humanoid")
local function removePlayer()
inRound[index] = nil
print("Now #inRound has decreased to " .. #inRound)
resetLighting:FireClient(foundPlayer,newMap)
print("Reseting lighting for " .. foundPlayer.Name)
end
--\\ Removing Connections
hum.Died:Connect(removePlayer)
players.PlayerRemoving:Connect(function(leavingPlayer)
for i = 1,#inRound do
if inRound[i] == leavingPlayer then
print("Removing " .. leavingPlayer.Name)
removePlayer()
end
end
end)
end
--\\ Exit Player
local exitRegion = game.Workspace:WaitForChild("ExitRegion")
local db = false
local function exit(hit)
if hit.Parent:FindFirstChild("Humanoid") and not db then
db = true
local player = players:GetPlayerFromCharacter(hit.Parent)
--\\ Finish Player
if player then
print(player.Name .. " isn't nil")
for index,finisher in pairs(inRound) do
if finisher == player.Name and not finished[index] then
finished[#finished + 1] = finisher
print(player.Name)
exitRemote:FireClient(player,exitRegion)
inRound[index] = nil
break
else
print(finisher .. " is not " .. player.Name)
end
end
end
wait(1)
db = false
end
end
exitRegion.Touched:Connect(exit)
while #inRound > 0 do
wait(1)
currentTime = currentTime + 1
if currentTime == MAX_TIME then
print("Max time reached")
for i = 1,#inRound do inRound[i] = nil end
print("currentTime variable has resetted to " .. currentTime)
break
end
if #inRound <= 0 then
break
end
end
--\\ Teleport player back
for _,winner in pairs(finished) do
print("Looping finished players")
local char = game.Workspace:FindFirstChild(winner)
if char:FindFirstChild("HumanoidRootPart") then
debugPrint("Character's HumanoidRootPart is not nil!")
local torso = char:WaitForChild("HumanoidRootPart")
torso.CFrame = CFrame.new(lobbySpawn.Position)
print(winner .. " has been inserted in the finished array")
else
print("The Character's HumanoidRootPart is nil!")
end
end
A recursive function in a LocalScript(this is with exitRemote.OnClientEvent event) in StarterGui
local function recurse(model)
for _,child in pairs(model:GetChildren()) do
if child:IsA("Model") then
recurse(model)
print("Child is a model, fixing!")
elseif child.Name == "KillScript" and child:IsA("Script") then
child.Disabled = true
end
end
end
recurse(game.Workspace:WaitForChild("Map"))

5 comments
you activated the output tab?
Why are you calling the function within the function?
I am calling a function within a function(recursion) because I need to find the model's children. I don't know when it ends so I simply use recursion
You can use GetDescendants now instead of GetChildren to get all descendants of the model (including children of children of children etc.), so no recursion required.
Oh, that's cool, I heard about it but didn't use it. I wasn't sure if it reach to the last child.