Script only registers most recent player to join the game?

Maybe I’m over looking something, but this while loop iterates over all players in the game every 0.2 seconds and compares their distance, yet it only registers the most recent player to join the game?

Eg:

Player 1 joins the game, he’s registered by the system.
Player 2 joins, player 1 is no longer registered and only player 2 is registered.

Apologies for messy code.

while wait(0.2) do
		if (capturePart.Position - bGoal.Position).magnitude <= 0.5 then
			TugOfWar:End("RED")
			break
		elseif (capturePart.Position - rGoal.Position).magnitude <= 0.5 then
			TugOfWar:End("BLUE")
			break
		end
			
		for _, PlayerValue in pairs (game.Players:GetPlayers()) do
			if PlayerValue
				and PlayerValue.Character
				and PlayerValue.Character:FindFirstChild("HumanoidRootPart")
				and (PlayerValue.Character.HumanoidRootPart.Position - capturePart.Position).Magnitude < 8 then
					
			if PlayerValue.Team == redTeam then
				if lastOwner == blueTeam or lastOwner == nil then
					print("lastowner == blueteam or lastOwner == nil AND player is == red team")
						lastTween = TweenService:Create(capturePart, TInfo, {CFrame = bGoal.CFrame})
						lastTween:Play()
						lastOwner = redTeam
					elseif lastTween ~= nil and lastOwner == redTeam then
						print("lasttween ~= nil and lastOwner == redTeam")
						lastTween:Play()
					end
				elseif PlayerValue.Team == blueTeam then
						
					if lastOwner == redTeam or lastOwner == nil then
							print("lastowner == blueteam or lastOwner == nil")
							lastTween = TweenService:Create(capturePart, TInfo, {CFrame = rGoal.CFrame})
							lastTween:Play()
							lastOwner = blueTeam
					elseif lastTween ~= nil and lastOwner == blueTeam then
							print("lasttween ~= nil and lastOwner == blueteam")
							lastTween:Play()
					end
				end
			else
				if lastTween ~= nil then
					lastTween:Pause()
				end
	
			end
				
		end -- end of for loop
	end
end

Turns out it actually runs, but the tweens don’t update.

print("lastowner == blueteam or lastOwner == nil AND player is == red team") -- PRINTS??
lastTween = TweenService:Create(capturePart, TInfo, {CFrame = rGoal.CFrame})
lastTween:Play() -- never happens apparently??
lastOwner = blueTeam

Connect this function to a player as soon as they join. This should guarantee that every player has this function.

The function is running, as in it’s printing when a player is near enough, but it doesn’t get around to playing the tween for some reason?

Try moving the Print function to after the tween and see if it still prints. If it does, we know it’s not stopping the script anywhere.