Script for jump height not working and i dont how fix this

i have issue that i want to increase player jump height then player team is playing but jump height increasing even then player team is lobby. Script type is normal script and it placed in ServerScriptService

local t1 = game.Teams.Playing

local t2 = game.Teams.Lobby

local t1P = {}
local t2L = {}

local function check()
	t1P = {}
	t2L = {}
	for i,v in pairs(game.Players:GetPlayers()) do
		if v.Team == t1 then
			table.insert(t1P,v)
		elseif v.Team == t2 then
			table.insert(t2L,v)
		end
	end
end
local play = coroutine.create(function()
	while task.wait(5) do
		check()
		for i, v in pairs(t1P) do
			if v.Character then
				local player = game.Players:GetPlayerFromCharacter(v.Character)
				local h = v.Character:FindFirstChild("Humanoid")
				if h then
					local counter = false
					h.JumpHeight += 5
					print("+5")
					h.Died:Connect(function()
						if player and player.Team == t2 then
							h.JumpHeight = 7.2
							if counter == false then
								print("end reutrn")
								return
							end
						end
					end)
					
				end
			end
		end
	end
end)

game.Players.PlayerAdded:Connect(function()
	check()
end)

coroutine.resume(play)

Wouldn’t the players be stuck in one team within this script forever with how a player is put in a team? Also maybe you can just do an if statement and table.find before the +5 on line 28 to see if the player is in the t1P list?

make sure you’re using jump height, not jump power (StarterPlayer)

no i have another script for team management, yes players kinda stuck in team and if i try table.find this dont finding

I think you should use

for seeing which team each player is in, that way it will always be up to date, otherwise you need a way to update the tables all the time which personally I wouldn’t see neccesary.
Then if you just have an if statement like

if(game.Teams.Playing:FindFirstChild(player) then -- game.Teams will always be updated from your other script, and this then checks that the player is in the "playing" team
    h.JumpHeight += 5
end

bro teams dont contain players even then players is playing, instead players who in Players service contain parameter Team and it is describes team