My script isn't working and I have no errors in the output

Well there’s not much to say but I’d really appreciate some help on why my script isn’t’ working. It’s very easy to ready so I won’t bother explaining.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local playersTable = {}

function TeleportPlayers()
	if script.GameRunning.Value == true or script.EnoughPlayers.Value == false then
		RunService.Heartbeat:Wait()
		return
	else
		script.GameRunning.Value = true
		local randomNumber = math.random(1, #playersTable)
		local player = playersTable[randomNumber]
		local character = game.Workspace:FindFirstChild(player)
		if not character or character:FindFirstChild("Head") then 
			TeleportPlayers()
		else 
			if character.Head.Name == (character.Head.Name.."lastchosen") then 
				TeleportPlayers()
			else 
				character.Head.Name = (character.Head.Name.."lastchosen")
				local originalname = character.Head.Name
				
				RunService.Heartbeat:Wait()
				character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.Podium.CFrame
				for i, v in pairs(Players:GetChildren()) do 
					if v.Name ~= player then 
						local char = game.Workspace:FindFirstChild(v.Name)
						char:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.Spectators.CFrame
					end
				end
				task.wait(10)
				script.GameRunning.Value = false
				TeleportPlayers()
				RunService.Heartbeat:Wait()
				character.Head.Name = originalname
			end
			
		end
		
	end

end

game.Players.PlayerAdded:Connect(function(player)
	table.insert(playersTable, player.Name)
	player.CharacterAdded:Connect(function(character)
		task.wait()
		if table.maxn(playersTable) >= 2 then 
			script.EnoughPlayers.Value = true
			TeleportPlayers()
		end
		character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.Spectators.CFrame
	end)
end)

game.Players.PlayerRemoving:Connect(function(player)
	table.remove(playersTable, table.find(playersTable, player.Name))
	task.wait()
	if table.maxn(playersTable) <= 2 then 
		script.EnoughPlayers.Value = false
	end
end)

I recommend describing what you’re trying to achieve with the script and what exactly is going wrong with it. Setting up a test environment to see how exactly the script isn’t working without any explanation is much more trouble than it’s worth.