Problem with redirecting players who in team table with different teams

i have problem with sorting to tables then i want to insert player in table somehow players splitting to different tables but teams are same, pls leave me some tips how to maybe make better my script
(script is located in ServerScriptService his type is basic script)

local t1 = game.Teams:FindFirstChild("Playing")
local t2 = game.Teams:FindFirstChild("Lobby")

local playersTable = {}

local function updatePlayerTable()
    local players = game.Players:GetPlayers()
    playersTable = {}
    for i = 1, #players do
        local player = players[i]
        table.insert(playersTable, player)
    end
end

local function handlePlayerJumpHeight()
    --here start of problem
    for i = 1, #playersTable do
        local player = playersTable[i]
        if player.Character then
            local h = player.Character:FindFirstChild("Humanoid")
            if h then
                if player.Team == t1 then
                    h.JumpHeight = 7.2 
                end
                if not h:GetAttribute("DiedConnected") then
                    h.Died:Connect(function()
                        if player and player.Team == t2 then
                            h.JumpHeight = 7.2
                            print("end return") 
                        end
                    end)
                    h:SetAttribute("DiedConnected", true)
                end
            end
        end
    end
end
-- there end of problem
local play = coroutine.create(function()
    while task.wait(5) do
        updatePlayerTable()
        handlePlayerJumpHeight()
    end
end)

coroutine.resume(play)